Issue Details (XML | Word | Printable)

Key: PCC-345
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

sizeof() should fail for incomplete type

Created: 09/May/11 07:42 PM   Updated: 11/May/11 10:13 PM
Component/s: Common code
Affects Version/s: None
Fix Version/s: None

Environment:
NetBSD lanfeust.sis.pasteur.fr 5.99.51 NetBSD 5.99.51 (LANFEUST) #46: Mon May 9 11:21:30 CEST 2011 njoly@lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj.amd64/sys/arch/amd64/compile/LANFEUST amd64
pcc 1.1.0.DEVEL 20110509 for x86_64-unknown-netbsd5.99.51, njoly@lanfeust.sis.pasteur.fr


 Description  « Hide
Calling sizeof() on an incomplete type should fail, but do not actually.

njoly@lanfeust [~]> cat sizeof.c
#include <stddef.h>
size_t len = sizeof(struct foo);
njoly@lanfeust [~]> pcc -c sizeof.c; echo $?
0
njoly@lanfeust [~]> gcc -c sizeof.c; echo $?
sizeof.c:2: error: invalid application of 'sizeof' to incomplete type 'struct foo'
1


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 11/May/11 10:13 PM
Fixed by not allowing size/align on undeclared structs.