Question about -O1 level

Mahmood Naderan
Mon Aug 2 08:31:37 GMT 2021

Thanks. With -fsanitize I got some more hints to find the problem.


On Friday, July 30, 2021, 8:56:28 PM GMT+2, Jonathan Wakely <> wrote: 

On Fri, 30 Jul 2021, 15:37 Marc Glisse, <> 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.

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?


More information about the Gcc-help mailing list