GCC 11.2: Illegal instruction when declaring a constexpr float constant exactly equal to 180.F
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:/
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!