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

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

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

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
njoly@petaure [~]> gcc -o /dev/null sample.c; echo $?

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
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.

Anders Magnusson made changes - 04/Aug/11 09:18 PM
Field Original Value New Value
Assignee Anders Magnusson [ ragge ]
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?

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 made changes - 14/Aug/11 05:12 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]