From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 4215B3858406 for ; Wed, 23 Feb 2022 00:33:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4215B3858406 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 21N0Wrna018942; Tue, 22 Feb 2022 18:32:53 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 21N0WrNQ018941; Tue, 22 Feb 2022 18:32:53 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Tue, 22 Feb 2022 18:32:53 -0600 From: Segher Boessenkool To: Krishna Narayanan Cc: Jonathan Wakely , gcc-help Subject: Re: Doubt regarding dg-directives Message-ID: <20220223003253.GC614@gate.crashing.org> References: <20220222154432.GV614@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Feb 2022 00:33:55 -0000 On Wed, Feb 23, 2022 at 12:00:47AM +0530, Krishna Narayanan wrote: > On Tue, Feb 22, 2022 at 9:16 PM Segher Boessenkool > 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