Bug 58489 - ICE: in reload_cse_simplify_operands, at postreload.c:411
Summary: ICE: in reload_cse_simplify_operands, at postreload.c:411
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.8.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-21 10:03 UTC by Timo Teräs
Modified: 2018-07-08 22:19 UTC (History)
3 users (show)

See Also:
Host: i486-alpine-linux-uclibc
Target: armv6-alpine-linux-muslgnueabihf
Build: i486-alpine-linux-uclibc
Known to work:
Known to fail:
Last reconfirmed: 2015-01-23 00:00:00


Attachments
preprocessed source triggering the issue (30.97 KB, text/x-csrc)
2013-09-21 10:03 UTC, Timo Teräs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Timo Teräs 2013-09-21 10:03:52 UTC
Created attachment 30876 [details]
preprocessed source triggering the issue

$ armv6-alpine-linux-muslgnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=armv6-alpine-linux-muslgnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/armv6-alpine-linux-muslgnueabihf/4.8.1/lto-wrapper
Target: armv6-alpine-linux-muslgnueabihf
Configured with: /home/tteras/aports/main/gcc/src/gcc-4.8.1/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --build=i486-alpine-linux-uclibc --host=i486-alpine-linux-uclibc --target=armv6-alpine-linux-muslgnueabihf --with-pkgversion='Alpine 4.8.1' --enable-checking=release --disable-fixed-point --disable-libstdcxx-pch --disable-multilib --disable-nls --disable-werror --disable-symvers --enable-__cxa_atexit --enable-esp --enable-cloog-backend --enable-languages=c,c++,ada --with-arch=armv6 --with-fpu=vfp --with-float=hard --disable-libquadmath --disable-libssp --disable-libmudflap --disable-libsanitizer --disable-bootstrap --enable-clocale=gnu --with-sysroot=/home/tteras/alpine-sysroot/armv6-alpine-linux-muslgnueabihf/ --enable-shared --enable-threads --enable-tls --disable-libgomp --disable-libatomic --disable-libitm --with-system-zlib
Thread model: posix
gcc version 4.8.1 (Alpine 4.8.1) 

armv6-alpine-linux-muslgnueabihf-gcc -Wp,-MD,networking/libiproute/.ipaddress.o.d  --sysroot=/home/tteras/alpine-sysroot/armv6-alpine-linux-muslgnueabihf/ -march=armv6 -mfpu=vfp -mhard-float -Os -fomit-frame-pointer -pipe -fPIC -std=gnu99 -Iinclude -Ilibbb -Iinclude2 -I/home/tteras/aports/main/busybox/src/busybox-1.21.1/include -I/home/tteras/aports/main/busybox/src/busybox-1.21.1/libbb -include include/autoconf.h -D_GNU_SOURCE -DNDEBUG -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D"BB_VER=KBUILD_STR(1.21.1)" -DBB_BT=AUTOCONF_TIMESTAMP -I/home/tteras/aports/main/busybox/src/busybox-1.21.1/networking/libiproute -Inetworking/libiproute -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wno-format-security -Wdeclaration-after-statement -Wold-style-definition -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -static-libgcc -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -fno-unwind-tables -fno-asynchronous-unwind-tables -Os  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(ipaddress)"  -D"KBUILD_MODNAME=KBUILD_STR(ipaddress)" -c -o networking/libiproute/ipaddress.o /home/tteras/aports/main/busybox/src/busybox-1.21.1/
networking/libiproute/ipaddress.c
In file included from /home/tteras/aports/main/busybox/src/busybox-1.21.1/include/libbb.h:40:0,
                 from /home/tteras/aports/main/busybox/src/busybox-1.21.1/networking/libiproute/ip_common.h:5,
                 from /home/tteras/aports/main/busybox/src/busybox-1.21.1/networking/libiproute/ipaddress.c:15:
/home/tteras/alpine-sysroot/armv6-alpine-linux-muslgnueabihf/usr/include/sys/poll.h:1:2: warning: #warning redirect
ing incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
 #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
  ^
/home/tteras/aports/main/busybox/src/busybox-1.21.1/networking/libiproute/ipaddress.c: In function 'ipaddr_list_or_flush':
/home/tteras/aports/main/busybox/src/busybox-1.21.1/networking/libiproute/ipaddress.c:589:1: error: insn does not satisfy its constraints:
 }
 ^
(insn 1333 491 499 36 (set (reg:QI 0 r0)
        (reg:QI 13 sp)) /home/tteras/aports/main/busybox/src/busybox-1.21.1/networking/libiproute/ipaddress.c:494 198 {*arm_movqi_insn}
     (nil))
/home/tteras/aports/main/busybox/src/busybox-1.21.1/networking/libiproute/ipaddress.c:589:1: internal compiler error: in reload_cse_simplify_operands, at postreload.c:411
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The same code compiles with same gcc if targetting -march=armv7-a -mfpu=vfpv3.

Bug is reproduced with gcc-4.8.1 and gcc-linaro-4.8-2013.09.
Comment 1 Timo Teräs 2013-09-23 11:16:19 UTC
Simplifed commandline to:
armv6-alpine-linux-muslgnueabihf-gcc -Os -c -std=gnu99 aa.c -o aa.o

No ICE with:
armv6-alpine-linux-muslgnueabihf-gcc -c -std=gnu99 aa.c -o aa.o
armv6-alpine-linux-muslgnueabihf-gcc -march=armv7-a -Os -c -std=gnu99 aa.c -o aa.o

So "-march=armv6 -Os" triggers the issue.
Comment 2 Timo Teräs 2014-03-26 06:35:00 UTC
I got this fixed. It seems genautomata does not work properly if it is built with -fPIC. Since PIE/PIC get added automatically in alpine toolchain it caused this.

For now I'm adding explicitly -fno-PIC to genautomata compilation. However, it would be better if genautomata could be fixed to:
 - abort compilation if genautomata failed to do it's job properly
 - fix genautomata to work even if compiled with -fPIC
Comment 3 Ramana Radhakrishnan 2015-01-23 10:13:01 UTC
(In reply to Timo Teräs from comment #2)
> I got this fixed. It seems genautomata does not work properly if it is built
> with -fPIC. Since PIE/PIC get added automatically in alpine toolchain it
> caused this.
> 
> For now I'm adding explicitly -fno-PIC to genautomata compilation. However,
> it would be better if genautomata could be fixed to:
>  - abort compilation if genautomata failed to do it's job properly
>  - fix genautomata to work even if compiled with -fPIC

Interesting observation and interesting that the "broken automaton" managed to build the whole of gcc and the run time support libraries in gcc and presumably glibc. 

If it was genautomata that doesn't work properly when built with PIC can you reduce the failure point in genautomata. Without more details or better input testcases it's very hard to reduce this in any other way or form especially as I cannot reproduce the issue with a new top of tree 4.8 toolchain.
Comment 4 Eric Gallager 2018-07-08 22:19:53 UTC
(In reply to Ramana Radhakrishnan from comment #3)
> (In reply to Timo Teräs from comment #2)
> > I got this fixed. It seems genautomata does not work properly if it is built
> > with -fPIC. Since PIE/PIC get added automatically in alpine toolchain it
> > caused this.
> > 
> > For now I'm adding explicitly -fno-PIC to genautomata compilation. However,
> > it would be better if genautomata could be fixed to:
> >  - abort compilation if genautomata failed to do it's job properly
> >  - fix genautomata to work even if compiled with -fPIC
> 
> Interesting observation and interesting that the "broken automaton" managed
> to build the whole of gcc and the run time support libraries in gcc and
> presumably glibc. 
> 
> If it was genautomata that doesn't work properly when built with PIC can you
> reduce the failure point in genautomata. Without more details or better
> input testcases it's very hard to reduce this in any other way or form
> especially as I cannot reproduce the issue with a new top of tree 4.8
> toolchain.

bug has been stuck in WAITING long enough without being reproduced for it to be closed now.