"error: insn does not satisfy its constraints" using 5-2015q4

Bug #1530664 reported by Mark Müller
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
Fix Released
Undecided
Unassigned

Bug Description

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.

Revision history for this message
Mark Müller (s-mark-t) wrote :
Changed in gcc-arm-embedded:
status: New → Confirmed
Revision history for this message
Thomas Preud'homme (thomas-preudhomme) wrote :

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.

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) wrote :

Hi Mark,

The reason this fails is because -mslow-flash-data disable litteral pools and GCC does not know how to load the constant 9.99999974737875163555145263671875e-5 into a register. As a workaround for now I suggest compiling without -mslow-flash-data. In your example, this could be achieved by moving FunctionFails into a separate file which is compile without -mslow-flash-data so that only that function is compiled with -mslow-flash-data.

Best regards.

Revision history for this message
Mark Müller (s-mark-t) wrote :

Thanks Thomas!

My current solution, which works OK, is to wrap the function in a pragma which disables optimization.

Cheers
Mark

Changed in gcc-arm-embedded:
status: Confirmed → Fix Committed
Revision history for this message
Thomas Preud'homme (thomas-preudhomme) wrote :

This is fixed since our 6-2017Q2 release.

Changed in gcc-arm-embedded:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.