https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78580
Bug ID: 78580 Summary: Segfault in gcc with multilib (-m32) and -ffixed-* Product: gcc Version: 6.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: bugs-gcc at rationality dot eu Target Milestone: --- Created attachment 40187 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40187&action=edit Minimized testcase exhibiting the issue First off: the bug sounds slightly related to #68701, but that one is reported as RESOLVED FIXED and seems to be far more specific and tied to -ffixed-ebx. Sorry if this still is a duplicate. The issue: The compilation is terminated with an `internal compiler error: Segmentation fault` when trying to compile the attached testcase (foobar-min.0x.fixed.i). The segfault only happens when the code is compiled with `-ffixed-ebx -m32`. Compiler output with my distro-gcc (I'm using ArchLinux): > $ /tmp: gcc -v -ffixed-ebx -m32 -Wall -Wextra -Werror -c > foobar-min.0x.fixed.i -o foobar.o > Using built-in specs. > COLLECT_GCC=/usr/bin/gcc > Target: x86_64-pc-linux-gnu > Configured with: /build/gcc-multilib/src/gcc/configure --prefix=/usr > --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man > --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ > --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared > --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl > --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu > --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object > --enable-linker-build-id --enable-lto --enable-plugin > --enable-install-libiberty --with-linker-hash-style=gnu > --enable-gnu-indirect-function --enable-multilib --disable-werror > --enable-checking=release > Thread model: posix > gcc version 6.2.1 20160830 (GCC) > COLLECT_GCC_OPTIONS='-B' '/usr/lib/hardening-wrapper/bin' '-fPIE' > '-fstack-check=specific' '-fstack-protector-strong' '-v' '-ffixed-ebx' '-m32' > '-Wall' '-Wextra' '-Werror' '-c' '-o' 'foobar.o' '-mtune=generic' > '-march=x86-64' > /usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/cc1 -fpreprocessed > foobar-min.0x.fixed.i -quiet -dumpbase foobar-min.0x.fixed.i -m32 > -mtune=generic -march=x86-64 -auxbase-strip foobar.o -Wall -Wextra -Werror > -version -fPIE -fstack-check=specific -fstack-protector-strong -ffixed-ebx -o > /tmp/ccPviy6Q.s > GNU C11 (GCC) version 6.2.1 20160830 (x86_64-pc-linux-gnu) > compiled by GNU C version 6.2.1 20160830, GMP version 6.1.1, MPFR > version 3.1.4-p1, MPC version 1.0.3, isl version 0.15 > warning: MPFR header version 3.1.4-p1 differs from library version 3.1.5. > GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 > GNU C11 (GCC) version 6.2.1 20160830 (x86_64-pc-linux-gnu) > compiled by GNU C version 6.2.1 20160830, GMP version 6.1.1, MPFR > version 3.1.4-p1, MPC version 1.0.3, isl version 0.15 > warning: MPFR header version 3.1.4-p1 differs from library version 3.1.5. > GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 > Compiler executable checksum: 8532c1c062237a3d67fa873459bd34cd > foobar-min.0x.fixed.i: In function ‘StartOS’: > foobar-min.0x.fixed.i:4:2: internal compiler error: Segmentation fault > int StartOS(signed char f) { return f; } > ^~~ To verify, I've built gcc-svn, revision 242936. PATH was modified to point to the ./build/build/gcc/ directory. Output: > $ ./gcc/build/gcc/xgcc -v -ffixed-ebx -m32 -Wall -Wextra -Werror -c > foobar-min.0x.fixed.i -o foobar.o > Using built-in specs. > COLLECT_GCC=/srv/scratch/fo21qixo/gcc/build/gcc/xgcc > Target: x86_64-pc-linux-gnu > Configured with: ../gcc-svn/configure --enable-languages=c,c++,lto > --enable-shared --enable-threads=posix --enable-libmpx --with-isl > --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu > --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object > --enable-linker-build-id --enable-lto --enable-plugin > --enable-install-libiberty --with-linker-hash-style=gnu > --enable-gnu-indirect-function --enable-multilib --disable-werror > --enable-checking=release > Thread model: posix > gcc version 7.0.0 20161128 (experimental) (GCC) > COLLECT_GCC_OPTIONS='-v' '-ffixed-ebx' '-m32' '-Wall' '-Wextra' '-Werror' > '-c' '-o' 'foobar.o' '-mtune=generic' '-march=x86-64' > cc1 -fpreprocessed foobar-min.0x.fixed.i -quiet -dumpbase > foobar-min.0x.fixed.i -m32 -mtune=generic -march=x86-64 -auxbase-strip > foobar.o -Wall -Wextra -Werror -version -ffixed-ebx -o /tmp/ccQKFQbs.s > GNU C11 (GCC) version 7.0.0 20161128 (experimental) (x86_64-pc-linux-gnu) > compiled by GNU C version 7.0.0 20161128 (experimental), GMP version > 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version 0.15 > GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 > GNU C11 (GCC) version 7.0.0 20161128 (experimental) (x86_64-pc-linux-gnu) > compiled by GNU C version 7.0.0 20161128 (experimental), GMP version > 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version 0.15 > GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 > Compiler executable checksum: 2801dc23875b542e7454fd26ef7c7556 > foobar-min.0x.fixed.i: In function ‘StartOS’: > foobar-min.0x.fixed.i:4:2: internal compiler error: Segmentation fault > int StartOS(signed char f) { return f; } > ^~~ > 0x9b7faf crash_signal > ../../gcc-svn/gcc/toplev.c:333 > 0x635708 bitmap_find_bit > ../../gcc-svn/gcc/bitmap.c:510 > 0x635708 bitmap_set_bit(bitmap_head*, int) > ../../gcc-svn/gcc/bitmap.c:600 > 0x845452 update_bad_spill_attribute > ../../gcc-svn/gcc/ira-build.c:2651 > 0x84b84f ira_build() > ../../gcc-svn/gcc/ira-build.c:3425 > 0x843246 ira > ../../gcc-svn/gcc/ira.c:5217 > 0x843246 execute > ../../gcc-svn/gcc/ira.c:5522 Please notify me if you need any further information. N.B.: The testcase was preprocessed with `delta`. I think this is what you want. If you however require a more complete input set, I would be happy to provide one. It was extracted from the Open Source Trampoline OS.