Issue Details (XML | Word | Printable)

Key: PCC-275
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Iain Hibbert
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

external array reference causes compiler error with -fPIC

Created: 15/Mar/11 02:59 PM   Updated: 04/Sep/11 08:12 AM
Component/s: C frontend
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD/i386


 Description  « Hide
The following code fragment

extern char str[];

void foo(void)
{
        static char *a[] = { &str[1] };
}

when compiled with "pcc -fPIC" fails with

major internal compiler error: x.c, line 5

(it does work fine without -fPIC, without static, or referencing &str[0])

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Iain Hibbert added a comment - 15/Mar/11 03:02 PM
also fails if "str" is actually defined, eg 'char str[] = "hello";'

Anders Magnusson added a comment - 03/Sep/11 10:11 AM
Can you please recheck, it doesn'f fail for me...?

Iain Hibbert added a comment - 04/Sep/11 08:12 AM
Yes, it no longer fails for me either must have been fixed in the meantime :)