-O2 flag

Serpent7776 serpent7776 at gmail.com
Sat Jun 10 21:10:53 UTC 2017


On Sat, 10 Jun 2017 16:20:25 -0300
Friedrich Locke <friedrich.locke at gmail.com> wrote:

> Hi folks,
> 
> i am trying compile a program with cc on freebsd 11.
> When i use -O2 compilation flag, the compiled code is giving error on 
> execution, but with i omit -O2 everything works ok.
> 
> Have anybody already faced such problem ?
Yes, a few times in the past. Your code may have hidden bug which is triggered
only with optimizations enabled. It might be relying on some kind of undefined
behaviour.
Unfortunately, I don't have any helpful advices on how to find this error -
try enabling all compiler warnings flags.
I'd suspect a bug in your code rather than a bug in compiler, but the latter is
not impossible.

> Thanks in advance.
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"



-- 
/*
 * Serpent7776
 */


More information about the freebsd-questions mailing list