Re: How to trigger warning: 'di' is used uninitialized here

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 30, 2023 at 2:32 PM Xi Ruoyao <xry111@xxxxxxxxxxx> wrote:
>
> On Wed, 2023-08-30 at 14:25 +0200, Mathieu Malaterre via Gcc-help wrote:
> > Hi all,
> >
> > Consider the following silly c++ code (*), it compiles nicely using
> > g++ 13.2 no warnings using either:
> >
> > % g++  -c -O2 -Wall -Wextra alt.cxx
> >
> > or
> >
> > % g++  -c -O0 -Wall -Wextra alt.cxx
> >
> > Is it possible to trigger a warning for this code (maybe I missed some
> > gcc options) ?
>
> Analyzer does a better job for such a "complex" pattern:
>
> $ gcc -Wall -Wextra t.cc -fanalyzer -S

Cool ! Documentation is somewhat unclear to me as `-fanalyzer` seems
to be required (I cannot simply use
-Wanalyzer-use-of-uninitialized-value) (*)

Could someone confirm that my code cannot trigger one of the
`fsanitize=undefined` logic ? valgrind sees the uninitialised read:

==459913== Conditional jump or move depends on uninitialised value(s)

Thanks again

(*)
https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/Static-Analyzer-Options.html




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux