public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Krishna Narayanan <krishnanarayanan132002@gmail.com>
Cc: Jonathan Wakely <jwakely.gcc@gmail.com>, gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Doubt regarding dg-directives
Date: Tue, 22 Feb 2022 18:32:53 -0600	[thread overview]
Message-ID: <20220223003253.GC614@gate.crashing.org> (raw)
In-Reply-To: <CABhGnjtWdGCoV_ySUmaPMKRdcFdasta9UfQYGLRN2AVSjEgr_w@mail.gmail.com>

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@kernel.crashing.org> 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

  reply	other threads:[~2022-02-23  0:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 11:42 Krishna Narayanan
2022-02-22 14:31 ` Jonathan Wakely
2022-02-22 14:32   ` Jonathan Wakely
2022-02-22 15:38     ` Krishna Narayanan
2022-02-22 15:44       ` Segher Boessenkool
2022-02-22 18:30         ` Krishna Narayanan
2022-02-23  0:32           ` Segher Boessenkool [this message]
2022-02-22 16:14       ` Jonathan Wakely
2022-02-23  7:39         ` Krishna Narayanan
2022-02-23  8:16           ` Jonathan Wakely
2022-02-23 13:47             ` Krishna Narayanan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220223003253.GC614@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    --cc=krishnanarayanan132002@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).