public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Question about -O1 level
       [not found] <466106944.823515.1627654974349.ref@mail.yahoo.com>
@ 2021-07-30 14:22 ` Mahmood Naderan
  2021-07-30 14:36   ` Marc Glisse
  0 siblings, 1 reply; 4+ messages in thread
From: Mahmood Naderan @ 2021-07-30 14:22 UTC (permalink / raw)
  To: gcc-help

Hi

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. 

Any thoughts on that?

[1] https://gcc.gnu.org/onlinedocs/gcc-9.3.0/gcc/Optimize-Options.html


Regards,
Mahmood

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about -O1 level
  2021-07-30 14:22 ` Question about -O1 level Mahmood Naderan
@ 2021-07-30 14:36   ` Marc Glisse
  2021-07-30 18:56     ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Glisse @ 2021-07-30 14:36 UTC (permalink / raw)
  To: Mahmood Naderan; +Cc: gcc-help

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


-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about -O1 level
  2021-07-30 14:36   ` Marc Glisse
@ 2021-07-30 18:56     ` Jonathan Wakely
  2021-08-02  8:31       ` Mahmood Naderan
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2021-07-30 18:56 UTC (permalink / raw)
  To: gcc-help

On Fri, 30 Jul 2021, 15:37 Marc Glisse, <marc.glisse@inria.fr> 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?



>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question about -O1 level
  2021-07-30 18:56     ` Jonathan Wakely
@ 2021-08-02  8:31       ` Mahmood Naderan
  0 siblings, 0 replies; 4+ messages in thread
From: Mahmood Naderan @ 2021-08-02  8:31 UTC (permalink / raw)
  To: gcc-help, Jonathan Wakely



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@gmail.com> wrote: 







On Fri, 30 Jul 2021, 15:37 Marc Glisse, <marc.glisse@inria.fr> 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?


> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-02  8:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <466106944.823515.1627654974349.ref@mail.yahoo.com>
2021-07-30 14:22 ` Question about -O1 level Mahmood Naderan
2021-07-30 14:36   ` Marc Glisse
2021-07-30 18:56     ` Jonathan Wakely
2021-08-02  8:31       ` Mahmood Naderan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).