public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/54363] New: ICE when compiling malformed struct initializers
@ 2012-08-24 4:31 kamaraju at gmail dot com
2012-08-24 8:35 ` [Bug c/54363] [4.6/4.7/4.8 Regression] " jakub at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: kamaraju at gmail dot com @ 2012-08-24 4:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54363
Bug #: 54363
Summary: ICE when compiling malformed struct initializers
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: kamaraju@gmail.com
Created attachment 28076
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28076
preprocessed source code with gcc 4.7.1
This bug is originally reported by Bernhard as
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684635
The following invalid code triggers an ICE with gcc-4.7
$cat t.c
struct bla{char **a;};void test(void){struct bla b = {.a =(char**){"a","b"}};}
$gcc -c t.c
t.c: In function ‘test’:
t.c:1:46: warning: initialization from incompatible pointer type [enabled by
default]
t.c:1:46: warning: (near initialization for ‘(anonymous)’) [enabled by default]
t.c:1:46: warning: excess elements in scalar initializer [enabled by default]
t.c:1:46: warning: (near initialization for ‘(anonymous)’) [enabled by default]
t.c:1:50: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccS0X8p2.out file, please attach this to
your bugreport.
Attaching the preprocessed source code as ccS0X8p2.out . I am using
$gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.7/lto-wrapper
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.1-2'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --enable-targets=all --with-arch-32=i586
--with-tune=generic --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.7.1 (Debian 4.7.1-2)
The same ICE also occurs with gcc version 4.6.2 (Debian 4.6.2-12). But gcc
version 4.4.7 (Debian 4.4.7-1) compiles with a warning.
$gcc-4.4 -c t.c
t.c: In function ‘test’:
t.c:1: warning: initialization from incompatible pointer type
t.c:1: warning: excess elements in scalar initializer
t.c:1: warning: (near initialization for ‘(anonymous)’)
$gcc-4.4 -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.7-1'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.4 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-targets=all --with-arch-32=i586 --with-tune=generic
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu
Thread model: posix
gcc version 4.4.7 (Debian 4.4.7-1)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/54363] [4.6/4.7/4.8 Regression] ICE when compiling malformed struct initializers
2012-08-24 4:31 [Bug c/54363] New: ICE when compiling malformed struct initializers kamaraju at gmail dot com
@ 2012-08-24 8:35 ` jakub at gcc dot gnu.org
2012-08-24 9:08 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-08-24 8:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54363
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-08-24
CC| |bonzini at gnu dot org,
| |jakub at gcc dot gnu.org,
| |jsm28 at gcc dot gnu.org
Target Milestone|--- |4.6.4
Summary|ICE when compiling |[4.6/4.7/4.8 Regression]
|malformed struct |ICE when compiling
|initializers |malformed struct
| |initializers
Ever Confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-08-24 08:35:15 UTC ---
Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145256
The problem is that a COMPOUND_LITERAL_EXPR doesn't have CONSTRUCTOR as its
DECL_INITIAL. Either this is a FE bug (tree.def says that it should be
CONSTRUCTOR), or we should just tweak optimize_compound_literals_in_ctor not to
recurse if TREE_CODE (init) is not CONSTRUCTOR.
Correct source would be
struct bla{char **a;};void test(void){struct bla b = {.a =(char*[]){"a","b"}};}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/54363] [4.6/4.7/4.8 Regression] ICE when compiling malformed struct initializers
2012-08-24 4:31 [Bug c/54363] New: ICE when compiling malformed struct initializers kamaraju at gmail dot com
2012-08-24 8:35 ` [Bug c/54363] [4.6/4.7/4.8 Regression] " jakub at gcc dot gnu.org
@ 2012-08-24 9:08 ` jakub at gcc dot gnu.org
2012-08-24 21:46 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-08-24 9:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54363
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-08-24 09:08:09 UTC ---
--- gimplify.c.jj 2012-08-15 10:55:33.000000000 +0200
+++ gimplify.c 2012-08-24 11:01:55.253815273 +0200
@@ -3857,7 +3857,8 @@ optimize_compound_literals_in_ctor (tree
if (!TREE_ADDRESSABLE (value)
&& !TREE_ADDRESSABLE (decl)
- && init)
+ && init
+ && TREE_CODE (init) == CONSTRUCTOR)
newval = optimize_compound_literals_in_ctor (init);
}
if (newval == value)
fixes the ICE, we end up with b.a = (char **) "a".
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/54363] [4.6/4.7/4.8 Regression] ICE when compiling malformed struct initializers
2012-08-24 4:31 [Bug c/54363] New: ICE when compiling malformed struct initializers kamaraju at gmail dot com
2012-08-24 8:35 ` [Bug c/54363] [4.6/4.7/4.8 Regression] " jakub at gcc dot gnu.org
2012-08-24 9:08 ` jakub at gcc dot gnu.org
@ 2012-08-24 21:46 ` jakub at gcc dot gnu.org
2012-09-03 16:03 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-08-24 21:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54363
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-08-24 21:46:24 UTC ---
Author: jakub
Date: Fri Aug 24 21:46:17 2012
New Revision: 190657
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190657
Log:
PR c/54363
* gimplify.c (optimize_compound_literals_in_ctor): Only recurse
if init is a CONSTRUCTOR.
* gcc.dg/pr54363.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/pr54363.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimplify.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/54363] [4.6/4.7/4.8 Regression] ICE when compiling malformed struct initializers
2012-08-24 4:31 [Bug c/54363] New: ICE when compiling malformed struct initializers kamaraju at gmail dot com
` (2 preceding siblings ...)
2012-08-24 21:46 ` jakub at gcc dot gnu.org
@ 2012-09-03 16:03 ` jakub at gcc dot gnu.org
2012-09-03 16:07 ` [Bug c/54363] [4.6 " jakub at gcc dot gnu.org
2013-04-03 18:17 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-09-03 16:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54363
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-09-03 16:02:59 UTC ---
Author: jakub
Date: Mon Sep 3 16:02:52 2012
New Revision: 190898
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190898
Log:
Backported from mainline
2012-08-24 Jakub Jelinek <jakub@redhat.com>
PR c/54363
* gimplify.c (optimize_compound_literals_in_ctor): Only recurse
if init is a CONSTRUCTOR.
* gcc.dg/pr54363.c: New test.
Added:
branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/pr54363.c
Modified:
branches/gcc-4_7-branch/gcc/ChangeLog
branches/gcc-4_7-branch/gcc/gimplify.c
branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/54363] [4.6 Regression] ICE when compiling malformed struct initializers
2012-08-24 4:31 [Bug c/54363] New: ICE when compiling malformed struct initializers kamaraju at gmail dot com
` (3 preceding siblings ...)
2012-09-03 16:03 ` jakub at gcc dot gnu.org
@ 2012-09-03 16:07 ` jakub at gcc dot gnu.org
2013-04-03 18:17 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-09-03 16:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54363
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org
|gnu.org |
Summary|[4.6/4.7/4.8 Regression] |[4.6 Regression] ICE when
|ICE when compiling |compiling malformed struct
|malformed struct |initializers
|initializers |
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-09-03 16:06:50 UTC ---
Fixed for 4.7+ so far.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/54363] [4.6 Regression] ICE when compiling malformed struct initializers
2012-08-24 4:31 [Bug c/54363] New: ICE when compiling malformed struct initializers kamaraju at gmail dot com
` (4 preceding siblings ...)
2012-09-03 16:07 ` [Bug c/54363] [4.6 " jakub at gcc dot gnu.org
@ 2013-04-03 18:17 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-04-03 18:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54363
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-04-03 18:17:37 UTC ---
Author: jakub
Date: Wed Apr 3 17:56:12 2013
New Revision: 197443
URL: http://gcc.gnu.org/viewcvs?rev=197443&root=gcc&view=rev
Log:
Backported from mainline
2012-08-24 Jakub Jelinek <jakub@redhat.com>
PR c/54363
* gimplify.c (optimize_compound_literals_in_ctor): Only recurse
if init is a CONSTRUCTOR.
* gcc.dg/pr54363.c: New test.
Added:
branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/pr54363.c
Modified:
branches/gcc-4_6-branch/gcc/ChangeLog
branches/gcc-4_6-branch/gcc/gimplify.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-04-03 18:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-24 4:31 [Bug c/54363] New: ICE when compiling malformed struct initializers kamaraju at gmail dot com
2012-08-24 8:35 ` [Bug c/54363] [4.6/4.7/4.8 Regression] " jakub at gcc dot gnu.org
2012-08-24 9:08 ` jakub at gcc dot gnu.org
2012-08-24 21:46 ` jakub at gcc dot gnu.org
2012-09-03 16:03 ` jakub at gcc dot gnu.org
2012-09-03 16:07 ` [Bug c/54363] [4.6 " jakub at gcc dot gnu.org
2013-04-03 18:17 ` jakub at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).