From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id E51E9385BC23 for ; Wed, 23 Feb 2022 08:16:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E51E9385BC23 Received: by mail-wr1-x42c.google.com with SMTP id v21so2959287wrv.5 for ; Wed, 23 Feb 2022 00:16:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=31WaA25eOlelNwpMRiqoTYiw/u02XOL/LnfJjfrEWb4=; b=P9+R8BVLi3P0b4hu5Ofbhr4wnrl2I0CynDscVOoaTE5B8OYYpPtrkHIpuKFFeqJCuy g5hZhf4KxUvPJQzPqPAedN9ZRxb3Mz0TtQfh53tm806lDjHOLZ8JvjiYTorQ2MlMVnhn Lo+Xc7R/rN1h1MqiXjobZ7vO21H08plPR305aU8e7sw7kdRo1bA+rslPCSaUeBVrD8OT ma3K/t+rgTuQeOgWBKH5Vcrx/Pajr6+KFTbweEAQlXv/GmMiaMpKG2Gdnul0R1hefYla vpin3aWDRf4q7YqLp/ul9WWAFBo1vhoyFvnjCxQC4JLvJfZ9ueMEgm9XQI6gJsb+Qiyt /EpA== X-Gm-Message-State: AOAM531BSIUi13Bw0dIqmVWR8OXUWroFWYjnwsXqdJI2HCQE3odd62RR GEHM1Loii6AXhffOF3lDlpA+IlMVJoDPB6OTU5k= X-Google-Smtp-Source: ABdhPJyUJSNl+M08xPlEAmgYoMIay1MnQNT8mT1WTOUSJYS6HDnEx9hfEmwdZZAtEVp6faYBtEUyV1p3dGE4nbSmjeI= X-Received: by 2002:a5d:47a1:0:b0:1e3:814:472d with SMTP id 1-20020a5d47a1000000b001e30814472dmr21908059wrb.395.1645604183917; Wed, 23 Feb 2022 00:16:23 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Wed, 23 Feb 2022 08:16:12 +0000 Message-ID: Subject: Re: Doubt regarding dg-directives To: Krishna Narayanan Cc: gcc-help , Segher Boessenkool X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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 08:16:26 -0000 On Wed, 23 Feb 2022 at 07:39, Krishna Narayanan < krishnanarayanan132002@gmail.com> wrote: > > > On Tue, Feb 22, 2022 at 9:44 PM Jonathan Wakely > wrote: > >> On Tue, 22 Feb 2022 at 15:38, Krishna Narayanan 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? >>> >> >> Don't you need -Wuninitialized in the dg-options as well? >> > > Yes I tried it with /* { dg-options "-O2 -Wuninitialized" } */ but still it FAILs. Yes, but it fails differently now. You need to read the output more carefully. Look at the gcc.log file, which shows you the full output. When you enable warnings there are TWO warnings printed. You are only testing for one. You can also compile the test by hand using the same options. What happens? You get TWO warnings. You only tested for one. So it's going to FAIL. The log file should show something like this: PASS: test.c (test for warnings, line 10) FAIL: test.c (test for excess errors) Excess errors: test.c:6: warning: 'a' may be used uninitialized [-Wmaybe-uninitialized] That means it matched the dg-warning on line 10, but there was also another warning on line 6, which dejagnu thinks was unexpected (because you didn't tell it to expect it or to ignore it). That makes the test fail.