[Bug c/95142] ICE when compiling certain logic with -Ofast and -mpretend-cmove when dealing with floats

2020-05-14 Thread hayden at hkowsoftware dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95142

--- Comment #2 from Hayden Kowalchuk  ---
slightly further testing shows all affected versions only need these flags to
trigger

sh4-linux-gnu-gcc-* -O1 -ffast-math -mpretend-cmove -c ice_sh4.c

[Bug c/95142] New: ICE when compiling certain logic with -Ofast and -mpretend-cmove when dealing with floats

2020-05-14 Thread hayden at hkowsoftware dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95142

Bug ID: 95142
   Summary: ICE when compiling certain logic with -Ofast and
-mpretend-cmove when dealing with floats
   Product: gcc
   Version: 9.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hayden at hkowsoftware dot com
  Target Milestone: ---

Created attachment 48537
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48537=edit
small self contained example showing the crash

this issue is exhibited by the included source in versions gcc 9.3 and 10.0.1
for the sh4 target.

It seems to be related to using cmove when dealing with access to a float using
an index from a pointer, included is a small ~60 line example demonstrating
this.

sh4-linux-gnu-gcc-9-Ofast -mpretend-cmove -c ice_sh4.c

ice_sh4.c: In function ‘call_create’:
ice_sh4.c:48:1: error: unrecognizable insn:
   48 | }
  | ^
(insn 26 25 27 2 (parallel [
(set (reg:SI 147 t)
(ge:SI (reg/v:SF 170 [ size_1 ])
(reg/v:SF 167 [ size_0 ])))
(clobber (reg:SI 155 fpscr1))
(use (reg:SI 154 fpscr0))
]) "ice_sh4.c":41:29 -1
 (nil))
during RTL pass: vregs
ice_sh4.c:48:1: internal compiler error: in extract_insn, at recog.c:2310



version info for gcc 9.3:
Using built-in specs.
COLLECT_GCC=sh4-linux-gnu-gcc-9
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/sh4-linux-gnu/9/lto-wrapper
Target: sh4-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 9.3.0-8'
--with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-9 --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/
--enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-libsanitizer --disable-libquadmath --disable-libquadmath-support
--enable-plugin --with-system-zlib --disable-libphobos --enable-multiarch
--disable-werror --with-cpu=sh4 --with-multilib-list=m4,m4-nofpu
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=sh4-linux-gnu --program-prefix=sh4-linux-gnu-
--includedir=/usr/sh4-linux-gnu/include --with-build-config=bootstrap-lto-lean
--enable-link-mutex
Thread model: posix
gcc version 9.3.0 (Debian 9.3.0-8)


version info for gcc 10.0.1:
Using built-in specs.
COLLECT_GCC=sh4-linux-gnu-gcc-10
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/sh4-linux-gnu/10/lto-wrapper
Target: sh4-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 10-20200418-1'
--with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-10 --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/
--enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-libsanitizer --disable-libquadmath --disable-libquadmath-support
--enable-plugin --with-system-zlib --disable-libphobos --enable-multiarch
--disable-werror --with-cpu=sh4 --with-multilib-list=m4,m4-nofpu
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=sh4-linux-gnu --program-prefix=sh4-linux-gnu-
--includedir=/usr/sh4-linux-gnu/include
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.0.1 20200418 (experimental) [master revision
27c171775ab:4c277008be0:c5bac7d127f288fd2f8a1f15c3f30da5903141c6] (Debian
10-20200418-1)