<< Back to previous view

[PCC-351] compilation failure, by wrongly detecting struct instead of nested block Created: 17/May/11  Updated: 14/Aug/11

Status: Resolved
Project: pcc
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Nicolas Joly Assignee: Anders Magnusson
Resolution: Fixed Votes: 0
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   
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


 Comments   
Comment by Gregory McGarry [ 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.
Comment by Anders Magnusson [ 04/Aug/11 09:19 PM ]
Hm, we do support it. I'm wondering why this particular statement won't compile?
Comment by Anders Magnusson [ 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.
Generated at Fri Sep 19 21:54:51 CEST 2014 using JIRA Enterprise Edition, Version: 3.13.1-#333.