This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/52635] gcc fails to diagnose invalid type in unused sizeof() when optimizing
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 20 Mar 2012 14:31:16 +0000
- Subject: [Bug c/52635] gcc fails to diagnose invalid type in unused sizeof() when optimizing
- Auto-submitted: auto-generated
- References: <bug-52635-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52635
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-20 14:31:16 UTC ---
I don't think this is a bug. For -std=c89 -pedantic-errors you get a proper
error - C89 doesn't have VLAs, but otherwise when optimizing the type is
considered just as a VLA type. You don't get any diagnostic even when you
actually use the sizeof (e.g. return it from the function), negative VLA size
doesn't have any diagnostic (most often it isn't even possible to diagnose it
at compile time).