I use the arm v9-2019-q4-major toolchain. I compile for the STM32H743 (also seen in the setting)
I compile using the following settings. CFLAG contains compiler settings.
CFLAGS += -D__FPU_PRESENTCFLAGS += -DARM_MATH_CM7CFLAGS += -DSTM32CFLAGS += -DSTM32H7CFLAGS += -DSTM32H743xxCFLAGS += -DSTM32H743XIHxCFLAGS += -std=c11CFLAGS += -mthumbCFLAGS += -mcpu=cortex-m7CFLAGS += -mfloat-abi=softfpCFLAGS += -mfpu=fpv5-d16CFLAGS += -gCFLAGS += -fmessage-length=0CFLAGS += -ffunction-sections CFLAGS += -fno-delete-null-pointer-checksCFLAGS += -Wstringop-overflowCFLAGS += -WerrorCFLAGS += -WallCFLAGS += -WextraCFLAGS += -Wno-missing-field-initializersCFLAGS += -Wdouble-promotion
I wonder why I experience different warnings in my code depending on the optimisation?
I have tried with -O0, -O1, -O2, -O3 and -Os.
I find (relevant) warnings - eg warning of variables that might be used non initialised - with -O1, that is not found when compiling using higher levels?
I experience that the number of warnings found increases with the optimisation level. -O3 finds more warnings that -O1.
Best regards Frank.
View all questions in Arm Compilers forum