Dominikus Gierlach

GCC: KDS toolchain segfaults when dividing _Accum types

Discussion created by Dominikus Gierlach on Apr 29, 2016
Latest reply on May 12, 2016 by Carlos_Mendoza

I use the gcc's fixed point extensions, which have been present in the gcc for Cortex-M since 2011.

 

The toolchain which is included in the current version of KDS (4.8.4 20140725 (release)) gives me a segmentation fault during compilation.

 

The segmentation fault happens when a long _Accum variable retVal is divided by an element of a referenced struct:

retVal = retVal / filter->numberOfElements;

 

Building file: ../Sources/drivers/filters.c

Invoking: Cross ARM C Compiler

arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O3 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -DKINETIS -DARM_MATH_CM4   -I"/opt/toolchain/CMSIS/CMSIS/Include" -I"/home/dominik/workspace.kds/test/Static_Code/PDD" -I"/home/dominik/workspace.kds/test/Static_Code/IO_Map" -I"/home/dominik/workspace.kds/test/Sources" -I"/home/dominik/workspace.kds/test/Generated_Code" -std=gnu99 -MMD -MP -MF"Sources/drivers/filters.d" -MT"Sources/drivers/filters.o" -c -o "Sources/drivers/filters.o" "../Sources/drivers/filters.c"

../Sources/drivers/filters.c: In function 'filters_updateMovingAverage':

../Sources/drivers/filters.c:172:1: internal compiler error: Segmentation fault

 

 

The current release of the toolchain (5.3.1 20160307 (release)) compiles without errors and works perfectly, hence it is not a big problem. It's still weird, though.

Compilation works flawlessly if I comment out the mentioned line.

Outcomes