GCC 11.2: Illegal instruction when declaring a constexpr float constant exactly equal to 180.F

Bug #1970028 reported by Carlos GP
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
New
Undecided
Unassigned

Bug Description

# arm-none-eabi-g++ --version
arm-none-eabi-g++ (GNU Toolchain for the Arm Architecture 11.2-2022.02 (arm-11.14)) 11.2.1 20220111
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# cat main.cpp
constexpr float kSomething = 180.F;

int main()
{}

# arm-none-eabi-g++ -std=c++14 main.cpp
main.cpp:1:1: internal compiler error: Illegal instruction
    1 | constexpr float kSomething = 180.F;
      | ^~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.linaro.org/> for instructions.

If I change the constant to e.g. 180.1F, then it works.

Incidently this magic number is often used to convert from degrees to radians.

The problem remains with constants like 90.F and 360.F. This is a real blocker for any kind of robotics project!

Tags: g++
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.