Bug 49029 - [4.6/4.7 Regression] ICE in simplify_subreg, at simplify-rtx.c:5266
Summary: [4.6/4.7 Regression] ICE in simplify_subreg, at simplify-rtx.c:5266
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.6.1
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-17 18:19 UTC by Ryan Mansfield
Modified: 2011-07-18 10:17 UTC (History)
2 users (show)

See Also:
Host: x86_64-linux-gnu
Target: arm-unknown-linux-gnueabi
Build: x86_64-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2011-05-18 09:57:22


Attachments
gcc46-pr49029.patch (656 bytes, patch)
2011-05-18 10:12 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Mansfield 2011-05-17 18:19:29 UTC
$ cat ~/ice.i
#pragma pack(1)

struct S0
{
  volatile unsigned f0:11;
  signed f2:30;
};

struct S1
{
  volatile struct S0 f7;
};

struct S1 a, b;

void
bar ()
{
  foo (a.f7.f0) && foo (b.f7.f2);
}

$ ./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: arm-unknown-linux-gnueabi
Configured with: ../configure --target=arm-unknown-linux-gnueabi --prefix=/home/ryan/x-tools/arm-unknown-linux-gnueabi --with-sysroot=/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi//sys-root --disable-multilib --with-local-prefix=/home/ryan/x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/sys-root --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-c99 --enable-long-long --enable-target-optspace target_alias=arm-unknown-linux-gnueabi --enable-languages=c++ --disable-shared --disable-libmudflap --disable-libssp
Thread model: posix
gcc version 4.7.0 20110517 (experimental) [trunk revision 173832] (GCC) 

$ ./xgcc -B. ~/ice.i
/home/ryan/ice.i: In function 'bar':
/home/ryan/ice.i:19:29: internal compiler error: in simplify_subreg, at simplify-rtx.c:5266
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Ryan Mansfield 2011-05-17 18:20:32 UTC
Update host/target fields
Comment 2 Jakub Jelinek 2011-05-18 10:11:16 UTC
I can reproduce with the trunk and 4.6 branch, works with 4.4, assuming it started with -fstrict-volatile-bitfields addition.
Comment 3 Jakub Jelinek 2011-05-18 10:12:16 UTC
Created attachment 24281 [details]
gcc46-pr49029.patch

Untested fix.  I can bootstrap/regtest this on x86_64 and i686, but can't on arm.  Can anyone please test it there?
Comment 4 Jakub Jelinek 2011-05-22 19:00:04 UTC
Author: jakub
Date: Sun May 22 19:00:00 2011
New Revision: 174034

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174034
Log:
	PR middle-end/49029
	* expmed.c (extract_fixed_bit_field): Test whether target can be used
	only after deciding which mode to use.

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

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr49029.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/expmed.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Jakub Jelinek 2011-05-22 19:03:02 UTC
Author: jakub
Date: Sun May 22 19:02:59 2011
New Revision: 174036

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174036
Log:
	PR middle-end/49029
	* expmed.c (extract_fixed_bit_field): Test whether target can be used
	only after deciding which mode to use.

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

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.c-torture/compile/pr49029.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/expmed.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 6 Jakub Jelinek 2011-05-22 19:05:08 UTC
Hopefully fixed.
Comment 7 Anitha Boyapati 2011-07-18 10:17:13 UTC
For 4.6.1 release, the corresponding testcase from regression fails for AVR target...

/home/anitha/patch-upgrade/gcc-4.6.1/gcc/testsuite/gcc.c-torture/compile/pr49029.c:2:8: error: width of 'g' exceeds its type
compiler exited with status 1
FAIL: gcc.c-torture/compile/pr49029.c  -O0  (test for excess errors)


Compiler specs 
--------------

Using built-in specs.
COLLECT_GCC=avr-gcc
COLLECT_LTO_WRAPPER=/home/anitha/install/libexec/gcc/avr/4.6.1/lto-wrapper
Target: avr
Configured with: ../configure --prefix=/home/anitha/install --target=avr --with-gmp=/proj/install/gmp-4.3.2/ --with-mpfr=/proj/install/mpfr-2.4.2/ --with-mpc=/proj/install/mpc-0.8.2/ --enable-languages=c,c++ --disable-libssp --disable-nls --with-dwarf2
Thread model: single
gcc version 4.6.1 (GCC)