From: SourceForge.net <no...@so...> - 2004-01-27 14:11:26
|
Bugs item #883734, was opened at 2004-01-24 21:14 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=883734&group_id=599 Category: C-Front End Group: None Status: Open Resolution: None Priority: 5 Submitted By: Stas Sergeev (stsp) Assigned to: Nobody/Anonymous (nobody) Summary: sizeof applied to an incomplete type gives 0 Initial Comment: Hi. That looks like a bug that sdcc eats the code like this, compiling the "sizeof" as zero: --- #include <string.h> struct { char a; short b; } test; char main() { memset(&test, 0, sizeof(struct test)); return test.a; } --- This is how gcc handles that: $ gcc struct.c struct.c: In function `main': struct.c:9: sizeof applied to an incomplete type Perfect error message above, but sdcc just compiles the broken code for that example. Could it please also print an error message instead, the way gcc does? The example is attached. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=883734&group_id=599 |