Bug 48517 - [4.6/4.7 Regression] ICE in build_unary_op, at c-typeck.c:3786
Summary: [4.6/4.7 Regression] ICE in build_unary_op, at c-typeck.c:3786
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.1
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2011-04-08 14:26 UTC by etienne_lorrain
Modified: 2011-04-12 07:06 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-04-08 15:00:00


Attachments
The file which produces the ICE (58.92 KB, application/octet-stream)
2011-04-08 14:26 UTC, etienne_lorrain
Details
gcc46-pr48517.patch (653 bytes, patch)
2011-04-11 13:24 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description etienne_lorrain 2011-04-08 14:26:33 UTC
Created attachment 23929 [details]
The file which produces the ICE

If I type (locally generated libmpc and libgmp):
LD_PRELOAD=/home/etienne/projet/toolchain/lib/libmpc.so:/home/etienne/projet/toolchain/lib/libgmp.so /home/etienne/projet/toolchain/bin/gcc  main.i
with the attached main.i, I get two warnings and:
main.c: In function ‘is_valid_chgmode_keycode’:
main.c:2575:3: internal compiler error: in build_unary_op, at c-typeck.c:3786
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

I am not sure I have generated perfectly gcc-4.6.0 - first time I generate this version,
but I used to be able to generate gcc-4.5.* and compile that file.

$ LD_PRELOAD=/home/etienne/projet/toolchain/lib/libmpc.so:/home/etienne/projet/toolchain/lib/libgmp.so /home/etienne/projet/toolchain/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/etienne/projet/toolchain/bin/gcc
COLLECT_LTO_WRAPPER=/home/etienne/projet/toolchain/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=/home/etienne/projet/toolchain --enable-languages=c --with-gmp=/home/etienne/projet/toolchain --disable-multilib --disable-threads --enable-tls
Thread model: single
gcc version 4.6.0 (GCC)
Comment 1 Richard Biener 2011-04-08 15:00:00 UTC
Confirmed, reducing.
Comment 2 Richard Biener 2011-04-08 15:01:34 UTC
Reduced testcase:

unsigned is_valid_chgmode_keycode (unsigned short key)
{
  static const unsigned short array[] = (const unsigned short []) { 0x0D2B };
  const unsigned short *ptr = array;
}
Comment 3 Jakub Jelinek 2011-04-11 13:02:03 UTC
Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160312
Comment 4 Jakub Jelinek 2011-04-11 13:24:23 UTC
Created attachment 23955 [details]
gcc46-pr48517.patch

Untested fix.
Comment 5 Jakub Jelinek 2011-04-12 06:43:15 UTC
Author: jakub
Date: Tue Apr 12 06:43:12 2011
New Revision: 172299

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172299
Log:
	PR c/48517
	* c-typeck.c (store_init_value): Set TREE_TYPE (decl) to
	qualified type.

	* gcc.c-torture/compile/pr48517.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr48517.c
Modified:
    trunk/gcc/c-typeck.c
Comment 6 Jakub Jelinek 2011-04-12 06:53:17 UTC
Author: jakub
Date: Tue Apr 12 06:53:13 2011
New Revision: 172300

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172300
Log:
	PR c/48517
	* c-typeck.c (store_init_value): Set TREE_TYPE (decl) to
	qualified type.

	* gcc.c-torture/compile/pr48517.c: New test.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.c-torture/compile/pr48517.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/c-typeck.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 7 Jakub Jelinek 2011-04-12 07:06:24 UTC
Fixed.