Re: Doubt regarding dg-directives

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

 



On Wed, Feb 23, 2022 at 12:00:47AM +0530, Krishna Narayanan wrote:
> On Tue, Feb 22, 2022 at 9:16 PM Segher Boessenkool
> <segher@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Tue, Feb 22, 2022 at 09:08:40PM +0530, Krishna Narayanan via Gcc-help wrote:
> > > Yes, it does.
> > > I used dg-warning and not dg warning (that was a sheer typing mistake).
> > > The warning is about the uninitialized variable being used in the
> > > testcase yet there is no warning on that line and the test results in
> > > FAIL.
> > > I used /* { dg-warning "uninitialized" } */ on that particular line.I
> > > used the test in gcc.dg, with other directive /* { dg-options "-O2" }
> > > */ .
> > > Can you help me where I went wrong?
> >
> > Please send the verbatim testcase (and don't top-post please).  Guessing
> > is a fun game sometimes, but more often it is just frustrating.
> /* { dg-do compile } */
> /* { dg-options "-O2" } */
>  int test(int y) {
>     int z;
>     int x;
>     int a;
>     for (x = 0; x < 10; x = x + 1, y = y + 1,a = a + 1)
>     {
>         if (y < 10) {
>             z = z + 1 + a; /* { dg-warning "uninitialized" } */
>         }
>     }
>     return z;
> }

Thanks.  As Jonathan said, you need to enable this warning in the
options, the testsuite does not enable more warnings than GCC does
itself.


Segher



[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