This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

GCC 11.2 arm-none-eabi, internal compiler error: Illegal instruction

Hello.

I am trying to use GCC 11.2 on Ubuntu 21.04 (x86_64 Linux hosted cross toolchains, gcc-arm-11.2-2022.02-x86_64-arm-none-eabi.tar.xz) to compile a program for STM32 (Cortex-M).

If I use float in the program, the build fails with an error "internal compiler error: Illegal instruction". If I do not use float, the build succeeds. If I change the toolchain path in Makefile to 10.3, the build succeeds with and without float.

Here is an example of the code I am trying to build:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
#include "main.h"
int main(void){
float f;
while(1){
f = f + 0.1;
};
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

And here is my Makefile:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
TARGET = firmware
DEBUG = 1
OPT = -O2
BUILD_DIR = build
C_SOURCES = \
main.c
ASM_SOURCES = \
startup.s
#Path to GCC10.3
GCC_PATH = ~/soft/gcc-arm-none-eabi/bin
#Path to GCC11.2
#GCC_PATH = ~/soft/gcc-arm-11.2-2022.02-x86_64-arm-none-eabi/bin
PREFIX = arm-none-eabi-
CC = $(GCC_PATH)/$(PREFIX)gcc
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
CP = $(GCC_PATH)/$(PREFIX)objcopy
SZ = $(GCC_PATH)/$(PREFIX)size
HEX = $(CP) -O ihex
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

If I try to build with GCC 11.2, I get an error:

Fullscreen
1
2
3
main.c:8:17: internal compiler error: Illegal instruction
8 | f = f + 0.1;
| ^
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

If I just change GCC_PATH in Makefile to 10.3, the build succeeds.

0