Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Jun 2017 14:25:17 +0200
From:      Serpent7776 <serpent7776@gmail.com>
To:        Friedrich Locke <friedrich.locke@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: -O2 flag
Message-ID:  <20170611142517.5898c64e@DaemONX>
In-Reply-To: <593C892D.4070200@gmail.com>
References:  <593C4679.5010104@gmail.com> <20170610230928.581e3cf9@DaemONX> <593C892D.4070200@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 10 Jun 2017 21:05:01 -0300
Friedrich Locke <friedrich.locke@gmail.com> wrote:

> Here you have it:
> 
> gustav# cc --version
> FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on 
> LLVM 3.8.0)
> Target: x86_64-unknown-freebsd11.0
> Thread model: posix
> InstalledDir: /usr/bin
> gustav#
This is not telling much. As pointed by Patrick this might be due to
uninitialized stack variables in a function.
You might want to try to:
- rebuild with enabled compiler warning flags (-W flags)
  https://clang.llvm.org/docs/DiagnosticsReference.html
- rebuild with sanitizer enabled
  https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
- try running in debugger and find place where this error occurs
HTH


> Em 10/06/2017 18:09, Serpent7776 escreveu:
> > On Sat, 10 Jun 2017 16:20:25 -0300
> > Friedrich Locke <friedrich.locke@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@freebsd.org mailing list
> >> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> >> To unsubscribe, send any mail to
> >> "freebsd-questions-unsubscribe@freebsd.org"  
> >
> >
> >  



-- 
/*
 * Serpent7776
 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170611142517.5898c64e>