<< Back to previous view

[PCC-275] external array reference causes compiler error with -fPIC Created: 15/Mar/11  Updated: 04/Sep/11

Status: Closed
Project: pcc
Component/s: C frontend
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Iain Hibbert Assignee: Anders Magnusson
Resolution: Fixed Votes: 0
Environment: NetBSD/i386


 Description   
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])

 Comments   
Comment by Iain Hibbert [ 15/Mar/11 03:02 PM ]
also fails if "str" is actually defined, eg 'char str[] = "hello";'
Comment by Anders Magnusson [ 03/Sep/11 10:11 AM ]
Can you please recheck, it doesn'f fail for me...?
Comment by Iain Hibbert [ 04/Sep/11 08:12 AM ]
Yes, it no longer fails for me either must have been fixed in the meantime :)
Generated at Thu Oct 02 04:19:15 CEST 2014 using JIRA Enterprise Edition, Version: 3.13.1-#333.