I am building an FLOSS project and getting Segmentation faults during build-time (where it runs an project created exe).
The project is created using MinGW64 GCC version (Rev3, Built by MSYS2 project) 10.2.0.
The project is SDCC; I am trying to package it under MSys2 64 bit MinGW.
It has the Segmentation faults when option "-O1" is used.
But, does not have the Segmentation faults when option "-O2" is used.
From Optimize Options (Using the GNU Compiler Collection (GCC))
The flags added by "-O2" are:
I am trying to build with these added flags to see if the seg fault is present or not.Code:-falign-functions -falign-jumps -falign-labels -falign-loops -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively -fexpensive-optimizations -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads -finline-functions -finline-small-functions -findirect-inlining -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp -fisolate-erroneous-paths-dereference -flra-remat -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining -fpeephole2 -freorder-blocks-algorithm=stc -freorder-blocks-and-partition -freorder-functions -frerun-cse-after-loop -fschedule-insns -fschedule-insns2 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing -fthread-jumps -ftree-builtin-call-dce -ftree-pre -ftree-switch-conversion -ftree-tail-merge -ftree-vrp
It takes several hours for the build to finish.Code:_debug_FLAGS+=" -finline-functions" _debug_FLAGS+=" -finline-small-functions" _debug_FLAGS+=" -findirect-inlining" _debug_FLAGS+=" -foptimize-strlen" _debug_FLAGS+=" -ftree-switch-conversion"
Edit: My question is which of the 5 I should keep trying and which of the others I should try? I am guessing I will hit the max command line length if I try to use all the options.
Tim S.