Thanks. With -fsanitize I got some more hints to find the problem. Regards, Mahmood On Friday, July 30, 2021, 8:56:28 PM GMT+2, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: On Fri, 30 Jul 2021, 15:37 Marc Glisse, <marc.glisse@xxxxxxxx> wrote: > On Fri, 30 Jul 2021, Mahmood Naderan via Gcc-help wrote: > >> I have noticed that my program with -O1 receives segmentation fault >> while if I manually specify all 45 O1 switches described in [1], the >> programs runs without problem. The gcc version is 9.3.0. I wonder if -O1 >> do something more than those switches. > > https://gcc.gnu.org/wiki/FAQ#Is_-O1_.28-O2.2C-O3.2C_-Os_or_-Og.29_equivalent_to_individual_-foptimization_options.3F That's why what you tried doesn't work. Instead of trying to disable all the optimization passes, have you tried building your program with -fsanitize=undefined instead? > >