[Bug c/78580] New: Segfault in gcc with multilib (-m32) and -ffixed-*

2016-11-29 Thread bugs-gcc at rationality dot eu
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'

[Bug rtl-optimization/78580] [6 Regression] Segfault in gcc with multilib (-m32) and -ffixed-*

2017-01-19 Thread bugs-gcc at rationality dot eu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78580

bugs-gcc at rationality dot eu changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from bugs-gcc at rationality dot eu ---
Thanks for fixing