I have a CPP file which fails to compile with optimization levels -O2 and -O3. The output is
"
f.cpp: In function 'void FunctionFails(float, float&)':
f.cpp:121:1: error: insn does not satisfy its constraints:
}
^
(insn 53 52 92 2 (set (reg:SF 31 s15 [120])
(const_double:SF 9.99999974737875163555145263671875e-5 [0x0.d1b717p-13])) f.cpp:118 621 {*thumb2_movsf_vfp}
(expr_list:REG_EQUIV (const_double:SF 9.99999974737875163555145263671875e-5 [0x0.d1b717p-13])
(nil)))
f.cpp:121:1: internal compiler error: in extract_constrain_insn, at recog.c:2246
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
"
--------------------------------------------------------------
The output of `arm-none-eabi-g++ -v` is :
"
Using built-in specs.
COLLECT_GCC=arm-none-eabi-g++
COLLECT_LTO_WRAPPER=/usr/local/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/lto-wrapper
Target: arm-none-eabi
Configured with: /home/build/work/GCC-5-0-build/src/gcc/configure --target=arm-none-eabi --prefix=/home/build/work/GCC-5-0-build/install-native --libexecdir=/home/build/work/GCC-5-0-build/install-native/lib --infodir=/home/build/work/GCC-5-0-build/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/home/build/work/GCC-5-0-build/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/home/build/work/GCC-5-0-build/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/home/build/work/GCC-5-0-build/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/home/build/work/GCC-5-0-build/install-native/arm-none-eabi --build=i686-linux-gnu --host=i686-linux-gnu --with-gmp=/home/build/work/GCC-5-0-build/build-native/host-libs/usr --with-mpfr=/home/build/work/GCC-5-0-build/build-native/host-libs/usr --with-mpc=/home/build/work/GCC-5-0-build/build-native/host-libs/usr --with-isl=/home/build/work/GCC-5-0-build/build-native/host-libs/usr --with-cloog=/home/build/work/GCC-5-0-build/build-native/host-libs/usr --with-libelf=/home/build/work/GCC-5-0-build/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Tools for ARM Embedded Processors' --with-multilib-list=armv6-m,armv7-m,armv7e-m,armv7-r,armv8-m.base,armv8-m.main
Thread model: single
gcc version 5.2.1 20151202 (release) [ARM/embedded-5-branch revision 231848] (GNU Tools for ARM Embedded Processors)
"
--------------------------------------------------------------
The command I'm using to compile is:
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -std=c++0x -DSTM32F405RGTx -DSTM32F4 -DSTM32 -DDEBUG -Dnullptr=0U -DVS_LOGGING_LEVEL=10 -O2 -g3 -Wall -Wextra -Wpedantic -fmessage-length=0 -ffunction-sections -c -fno-exceptions -mslow-flash-data -save-temps f.cpp
--------------------------------------------------------------
The code is attached: (f.cpp)
---------------------------------------------------------------
NOTE: The file compiles OK if I use 4.9 2015q3.
Hi Mark,
I can indeed reproduce this bug on latest toolchain and will investigate this. Once I get a better understanding of what is going on, I might be able to give you a workaround.
Best regards.