Issue Details (XML | Word | Printable)

Key: PCC-351
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Nicolas Joly
Votes: 0
Watchers: 0
Operations

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

compilation failure, by wrongly detecting struct instead of nested block

Created: 17/May/11 11:57 PM   Updated: 14/Aug/11 05:12 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Environment:
NetBSD petaure.lan 5.99.51 NetBSD 5.99.51 (PETAURE) #23: Tue May 17 22:52:32 CEST 2011 njoly@petaure.lan:/local/src/NetBSD/obj.amd64/sys/arch/amd64/compile/PETAURE amd64
pcc 1.1.0.DEVEL 20110517 for x86_64-unknown-netbsd5.99.51, njoly@petaure.lan


 Description  « Hide
The following code (taken from GNU m4) fails to compile with pcc, wrongly detecting a struct where a nested block is used.
Removing the cast to void make the problem goes away.

njoly@petaure [~]> cat sample.c
int main() {
  (void)({ int f = 1; });
  return 0; }
njoly@petaure [~]> pcc -o /dev/null sample.c; echo $?
sample.c, line 2: unknown structure/union/enum
sample.c, line 2: unknown structure/union/enum
1
njoly@petaure [~]> gcc -o /dev/null sample.c; echo $?
0


 All   Comments   Change History      Sort Order: Descending order - Click to sort in ascending order
Anders Magnusson added a comment - 14/Aug/11 05:12 PM
The bug was that a void cast got sent down to target layers that were not prepared to handle it.
Now void casts are only handled in target+independent code.

Anders Magnusson added a comment - 04/Aug/11 09:19 PM
Hm, we do support it. I'm wondering why this particular statement won't compile?

Gregory McGarry added a comment - 24/May/11 02:47 AM
Yeah, this is now a common gnu extension. If we're going to define __GNUC__, we should probably support it.