From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 1A693385802D for ; Thu, 9 Dec 2021 17:43:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1A693385802D Received: by mail-ot1-x32b.google.com with SMTP id v15-20020a9d604f000000b0056cdb373b82so6974731otj.7 for ; Thu, 09 Dec 2021 09:43:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Ub64jIs9+tL9j6y4aNjxZPwlES1/OnUsNoQToFw3wi4=; b=sBeqw60GlBJ0Lt4W2OrTwZdRm4AS4BukqfVge+NMBSJqB1Hqj0cefPrusrMHL/UxYZ g3Wot+3xYtGkHVcLwCdR262OXHnkLisu1ZmDHnKmCenttlOnQqfS5JSpjl1oVMEcBKDA HxqfpMm4YP8oXC2Stb0Keh38kSyt0cBntRX2WR9DDywLC7pFcmUdwxPESjjIxZqHEe/k ZeOcCF71Ml7YGDTkdfTUTCldrpSKLp7dLNLMeDok4fhRR/TL0eMOgXX6khECPb7fr/rl dIM4uAh1BcL2g8Uwumbc1F9dCTRyMUOgBDR8KhwnPi/2Ktzelk6KE+nQyzYTAtwih/Q/ mJDg== X-Gm-Message-State: AOAM5322+x3nXZvsc3YcMTmqnuLFq+1Hw6zVMxlVyU6GxPMu5cbfzKlw Jo7YgQKNfPZNrKPrPi7YIu/GIe/oXao= X-Google-Smtp-Source: ABdhPJzv2usN2jRwsHgf4Yd8RIa9xkvXe3B/FA70qEGv4c4fZ4XNWw5ejq8iUMYlkHlse2LGmVg3xw== X-Received: by 2002:a05:6830:1049:: with SMTP id b9mr6635320otp.60.1639071787139; Thu, 09 Dec 2021 09:43:07 -0800 (PST) Received: from [192.168.0.41] (184-96-227-137.hlrn.qwest.net. [184.96.227.137]) by smtp.gmail.com with ESMTPSA id t12sm74383oor.21.2021.12.09.09.43.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Dec 2021 09:43:06 -0800 (PST) Subject: Re: [Patch]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables To: Qing Zhao , richard Biener Cc: gcc Patches References: <53205959-8D66-47D8-B88C-8B1D65B5D008@oracle.com> From: Martin Sebor Message-ID: Date: Thu, 9 Dec 2021 10:43:05 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <53205959-8D66-47D8-B88C-8B1D65B5D008@oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Dec 2021 17:43:13 -0000 On 12/7/21 8:36 AM, Qing Zhao via Gcc-patches wrote: > Hi, > > This patch is to resolve the following two issues in the current implemenation > of -ftrivial-auto-var-init: > > 1. The 3rd parameter of function .DEFERRED_INIT is IS_VLA currently, which is > not needed at all; > 2. The address taken variable is replaced with a temporary variable during > gimplification, and the original auto variable might be eliminated by > compiler optimization completely. as a result, the current uninitialized > warning analysis cannot report warnings for these variables. > > To solve the above problems, we change the 3rd paramter of function > .DEFERRED_INIT from IS_VLA to NAME of the DECL. During uninitialized warning > analysis phase, for the following stmt: > > _1 = .DEFERRED_INIT (4, 2, &"alt_reloc"[0]); > > The original user variable has been eliminated from the IR, the LHS is the > temporary variable that was created to replace it. we will get the necessary > information from this stmt for reportinng the warning message: > > A. the name of the DECL from the 3rd parameter of the call; > B. the location of the DECL from the location of the call; > C. the LHS is used to hold the information on whether the warning > has been issued or not to suppress warning messages when needed; > > the current testing cases are updated to reflect these changes. > > The patch has been bootstrapped and regressing tested on both x86 and aarch64, no issues. > > Okay for commit? This seems like a nifty solution. I just have a few notes inline on the tree-ssa-uninit.c changes. > > thanks. > > Qing > > ============================================== > ******The complete patch is > > From 5e529c9d36fa36f921c0a2fb23d44848bdd7723a Mon Sep 17 00:00:00 2001 > From: Qing Zhao > Date: Tue, 7 Dec 2021 15:25:23 +0000 > Subject: [PATCH] Enable -Wuninitialized + -ftrivial-auto-var-init for address > taken variables. > > This patch is to resolve the following two issues in the current implemenation > of -ftrivial-auto-var-init: > > 1. The 3rd parameter of function .DEFERRED_INIT is IS_VLA currently, which is > not needed at all; > 2. The address taken variable is replaced with a temporary variable during > gimplification, and the original auto variable might be eliminated by > compiler optimization completely. as a result, the current uninitialized > warning analysis cannot report warnings for these variables. > > To solve the above problems, we change the 3rd paramter of function > .DEFERRED_INIT from IS_VLA to NAME of the DECL. During uninitialized warning > analysis phase, for the following stmt: > > _1 = .DEFERRED_INIT (4, 2, &"alt_reloc"[0]); > > The original user variable has been eliminated from the IR, the LHS is the > temporary variable that was created to replace it. we will get the necessary > information from this stmt for reportinng the warning message: > > A. the name of the DECL from the 3rd parameter of the call; > B. the location of the DECL from the location of the call; > C. the LHS is used to hold the information on whether the warning > has been issued or not to suppress warning messages when needed; > > the current testing cases are updated to reflect these changes. > > gcc/ChangeLog: > > 2021-12-07 qing zhao > > * gimplify.c (gimple_add_init_for_auto_var): Delete the 3rd argument. > Change the 3rd argument of function .DEFERRED_INIT to the name of the > decl. > (gimplify_decl_expr): Delete the 3rd argument when call > gimple_add_init_for_auto_var. > * internal-fn.c (expand_DEFERRED_INIT): Update comments to reflect > the 3rd argument change of function .DEFERRED_INIT. > * tree-cfg.c (verify_gimple_call): Update comments and verification > to reflect the 3rd argument change of function .DEFERRED_INIT. > * tree-sra.c (generate_subtree_deferred_init): Delete the 3rd argument. > (sra_modify_deferred_init): Change the 3rd argument of function > .DEFERRED_INIT to the name of the decl. > * tree-ssa-uninit.c (warn_uninit): Handle .DEFERRED_INIT call with an > anonymous SSA_NAME specially. > (check_defs): Likewise. > (warn_uninit_phi_uses): Adjust the message format for warn_uninit. > (warn_uninitialized_vars): Likewise. > (warn_uninitialized_phi): Likewise. > > gcc/testsuite/ChangeLog: > > 2021-12-07 qing zhao > > * c-c++-common/auto-init-1.c: Adjust testcase to reflect the 3rd > argument change of function .DEFERRED_INIT. > * c-c++-common/auto-init-10.c: Likewise. > * c-c++-common/auto-init-11.c: Likewise. > * c-c++-common/auto-init-12.c: Likewise. > * c-c++-common/auto-init-13.c: Likewise. > * c-c++-common/auto-init-14.c: Likewise. > * c-c++-common/auto-init-15.c: Likewise. > * c-c++-common/auto-init-16.c: Likewise. > * c-c++-common/auto-init-2.c: Likewise. > * c-c++-common/auto-init-3.c: Likewise. > * c-c++-common/auto-init-4.c: Likewise. > * c-c++-common/auto-init-5.c: Likewise. > * c-c++-common/auto-init-6.c: Likewise. > * c-c++-common/auto-init-7.c: Likewise. > * c-c++-common/auto-init-8.c: Likewise. > * c-c++-common/auto-init-9.c: Likewise. > * c-c++-common/auto-init-esra.c: Likewise. > * c-c++-common/auto-init-padding-1.c: Likewise. > * gcc.dg/auto-init-uninit-16.c (testfunc): Adjust testcase to reflect > the fact that address taken variable can be warned. > * gcc.dg/auto-init-uninit-34.c (warn_scalar_1): Likewise. > (warn_scalar_2): Likewise. > * gcc.dg/auto-init-uninit-37.c (T1): Likewise. > (T2): Likewise. > * gcc.dg/auto-init-uninit-B.c (baz): Likewise. > * gcc.target/aarch64/auto-init-2.c: Adjust. > --- > gcc/gimplify.c | 17 ++- > gcc/internal-fn.c | 10 +- > gcc/testsuite/c-c++-common/auto-init-1.c | 20 ++-- > gcc/testsuite/c-c++-common/auto-init-10.c | 2 +- > gcc/testsuite/c-c++-common/auto-init-11.c | 2 +- > gcc/testsuite/c-c++-common/auto-init-12.c | 2 +- > gcc/testsuite/c-c++-common/auto-init-13.c | 4 +- > gcc/testsuite/c-c++-common/auto-init-14.c | 4 +- > gcc/testsuite/c-c++-common/auto-init-15.c | 2 +- > gcc/testsuite/c-c++-common/auto-init-16.c | 2 +- > gcc/testsuite/c-c++-common/auto-init-2.c | 20 ++-- > gcc/testsuite/c-c++-common/auto-init-3.c | 6 +- > gcc/testsuite/c-c++-common/auto-init-4.c | 6 +- > gcc/testsuite/c-c++-common/auto-init-5.c | 6 +- > gcc/testsuite/c-c++-common/auto-init-6.c | 6 +- > gcc/testsuite/c-c++-common/auto-init-7.c | 8 +- > gcc/testsuite/c-c++-common/auto-init-8.c | 8 +- > gcc/testsuite/c-c++-common/auto-init-9.c | 4 +- > gcc/testsuite/c-c++-common/auto-init-esra.c | 6 +- > .../c-c++-common/auto-init-padding-1.c | 2 +- > gcc/testsuite/gcc.dg/auto-init-uninit-16.c | 4 +- > gcc/testsuite/gcc.dg/auto-init-uninit-34.c | 8 +- > gcc/testsuite/gcc.dg/auto-init-uninit-37.c | 44 ++++---- > gcc/testsuite/gcc.dg/auto-init-uninit-B.c | 4 +- > .../gcc.target/aarch64/auto-init-2.c | 2 +- > gcc/tree-cfg.c | 39 ++----- > gcc/tree-sra.c | 12 +-- > gcc/tree-ssa-uninit.c | 102 +++++++++++++++--- > 28 files changed, 195 insertions(+), 157 deletions(-) > > diff --git a/gcc/gimplify.c b/gcc/gimplify.c > index 326476f0238..43ed374b27a 100644 > --- a/gcc/gimplify.c > +++ b/gcc/gimplify.c > @@ -1747,16 +1747,13 @@ force_labels_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) > Build a call to internal const function DEFERRED_INIT: > 1st argument: SIZE of the DECL; > 2nd argument: INIT_TYPE; > - 3rd argument: IS_VLA, 0 NO, 1 YES; > + 3rd argument: NAME of the DECL; > + > + as LHS = DEFERRED_INIT (SIZE of the DECL, INIT_TYPE, NAME of the DECL). */ > > - as LHS = DEFERRED_INIT (SIZE of the DECL, INIT_TYPE, IS_VLA) > - if IS_VLA is false, the LHS is the DECL itself, > - if IS_VLA is true, the LHS is a MEM_REF whose address is the pointer > - to this DECL. */ > static void > gimple_add_init_for_auto_var (tree decl, > enum auto_init_type init_type, > - bool is_vla, > gimple_seq *seq_p) > { > gcc_assert (auto_var_p (decl)); > @@ -1766,13 +1763,14 @@ gimple_add_init_for_auto_var (tree decl, > > tree init_type_node > = build_int_cst (integer_type_node, (int) init_type); > - tree is_vla_node > - = build_int_cst (integer_type_node, (int) is_vla); > + tree decl_name > + = build_string_literal (IDENTIFIER_LENGTH (DECL_NAME (decl)) + 1, > + IDENTIFIER_POINTER (DECL_NAME (decl))); > > tree call = build_call_expr_internal_loc (loc, IFN_DEFERRED_INIT, > TREE_TYPE (decl), 3, > decl_size, init_type_node, > - is_vla_node); > + decl_name); > > gimplify_assign (decl, call, seq_p); > } > @@ -1946,7 +1944,6 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p) > { > gimple_add_init_for_auto_var (decl, > flag_auto_var_init, > - is_vla, > seq_p); > /* The expanding of a call to the above .DEFERRED_INIT will apply > block initialization to the whole space covered by this variable. > diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c > index 08f94b7a17a..8b0a2fa369c 100644 > --- a/gcc/internal-fn.c > +++ b/gcc/internal-fn.c > @@ -3011,11 +3011,7 @@ expand_UNIQUE (internal_fn, gcall *stmt) > } > > /* Expand the IFN_DEFERRED_INIT function: > - LHS = DEFERRED_INIT (SIZE of the DECL, INIT_TYPE, IS_VLA); > - > - if IS_VLA is false, the LHS is the DECL itself, > - if IS_VLA is true, the LHS is a MEM_REF whose address is the pointer > - to this DECL. > + LHS = DEFERRED_INIT (SIZE of the DECL, INIT_TYPE, NAME of the DECL); > > Initialize the LHS with zero/pattern according to its second argument > INIT_TYPE: > @@ -3071,8 +3067,8 @@ expand_DEFERRED_INIT (internal_fn, gcall *stmt) > > if (!reg_lhs) > { > - /* If this is a VLA or the variable is not in register, > - expand to a memset to initialize it. */ > + /* If the variable is not in register, expand to a memset > + to initialize it. */ > mark_addressable (lhs); > tree var_addr = build_fold_addr_expr (lhs); > > diff --git a/gcc/testsuite/c-c++-common/auto-init-1.c b/gcc/testsuite/c-c++-common/auto-init-1.c > index 84ba0a90d45..df04358728b 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-1.c > +++ b/gcc/testsuite/c-c++-common/auto-init-1.c > @@ -29,13 +29,13 @@ void foo() > return; > } > > -/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(1, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" { target ilp32 } } } */ > -/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" { target lp64 } } } */ > -/* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" { target ilp32 } } } */ > -/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" { target lp64 } } } */ > -/* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 2, 0\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(1, 2, \&\"temp1\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 2, \&\"temp2\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 2, \&\"temp3\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 2, \&\"temp4\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 2, \&\"temp5\"" "gimple" { target ilp32 } } } */ > +/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 2, \&\"temp5\"" "gimple" { target lp64 } } } */ > +/* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 2, \&\"temp6\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 2, \&\"temp7\"" "gimple" { target ilp32 } } } */ > +/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 2, \&\"temp7\"" "gimple" { target lp64 } } } */ > +/* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 2, \&\"temp8\"" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-10.c b/gcc/testsuite/c-c++-common/auto-init-10.c > index f35205f2a30..dda7ea1e032 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-10.c > +++ b/gcc/testsuite/c-c++-common/auto-init-10.c > @@ -18,5 +18,5 @@ void foo() > return; > } > > -/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(2, 1, 0\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(2, 1, \&\"temp1\"" "gimple" } } */ > /* { dg-final { scan-tree-dump-not "temp2 = .DEFERRED_INIT \\(" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-11.c b/gcc/testsuite/c-c++-common/auto-init-11.c > index a2d66908d83..6eb468785ce 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-11.c > +++ b/gcc/testsuite/c-c++-common/auto-init-11.c > @@ -11,4 +11,4 @@ void foo(int n) > return; > } > > -/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 2, 1\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 2, \&\"arr\"" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-12.c b/gcc/testsuite/c-c++-common/auto-init-12.c > index f05d743fda0..964291c5bd9 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-12.c > +++ b/gcc/testsuite/c-c++-common/auto-init-12.c > @@ -11,4 +11,4 @@ void foo(int n) > return; > } > > -/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 1, 1\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 1, \&\"arr\"" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-13.c b/gcc/testsuite/c-c++-common/auto-init-13.c > index b0c0365b288..aa5883af770 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-13.c > +++ b/gcc/testsuite/c-c++-common/auto-init-13.c > @@ -19,5 +19,5 @@ int foo() > return d.b + var.bar.b; > } > > -/* { dg-final { scan-tree-dump "d = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "var = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump "d = .DEFERRED_INIT \\(4, 1, \&\"d\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "var = .DEFERRED_INIT \\(4, 1, \&\"var\"" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-14.c b/gcc/testsuite/c-c++-common/auto-init-14.c > index 986bb19faaf..dd1ff3e339d 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-14.c > +++ b/gcc/testsuite/c-c++-common/auto-init-14.c > @@ -19,5 +19,5 @@ int foo() > return d.b + var.bar.b; > } > > -/* { dg-final { scan-tree-dump "d = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "var = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump "d = .DEFERRED_INIT \\(4, 2, \&\"d\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "var = .DEFERRED_INIT \\(4, 2, \&\"var\"" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-15.c b/gcc/testsuite/c-c++-common/auto-init-15.c > index aa9d7fab68a..5857287ecbe 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-15.c > +++ b/gcc/testsuite/c-c++-common/auto-init-15.c > @@ -10,4 +10,4 @@ void foo(int a) > g(x); > } > > -/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 2, 1\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 2, \&\"x\"" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-16.c b/gcc/testsuite/c-c++-common/auto-init-16.c > index 86493eef9e4..1e309959fc5 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-16.c > +++ b/gcc/testsuite/c-c++-common/auto-init-16.c > @@ -10,4 +10,4 @@ void foo(int a) > g(x); > } > > -/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 1, 1\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 1, \&\"x\"" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-2.c b/gcc/testsuite/c-c++-common/auto-init-2.c > index 69768d6451d..6ac63bb1dda 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-2.c > +++ b/gcc/testsuite/c-c++-common/auto-init-2.c > @@ -29,13 +29,13 @@ void foo() > return; > } > > -/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(1, 1, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 1, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" { target ilp32 } } } */ > -/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" { target lp64 } } } */ > -/* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" { target ilp32 } } } */ > -/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" { target lp64 } } } */ > -/* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 1, 0\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(1, 1, \&\"temp1\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 1, \&\"temp2\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 1, \&\"temp3\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 1, \&\"temp4\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 1, \&\"temp5\"" "gimple" { target ilp32 } } } */ > +/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 1, \&\"temp5\"" "gimple" { target lp64 } } } */ > +/* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 1, \&\"temp6\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 1, \&\"temp7\"" "gimple" { target ilp32 } } } */ > +/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 1, \&\"temp7\"" "gimple" { target lp64 } } } */ > +/* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 1, \&\"temp8\"" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-3.c b/gcc/testsuite/c-c++-common/auto-init-3.c > index 062d60c1631..9d9c86d8dd0 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-3.c > +++ b/gcc/testsuite/c-c++-common/auto-init-3.c > @@ -14,6 +14,6 @@ long double foo() > return result; > } > > -/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 2, 0\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 2, \&\"temp1\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 2, \&\"temp2\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 2, \&\"temp3\"" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-4.c b/gcc/testsuite/c-c++-common/auto-init-4.c > index 9d8f23ed4e3..848df2a0e26 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-4.c > +++ b/gcc/testsuite/c-c++-common/auto-init-4.c > @@ -14,6 +14,6 @@ long double foo() > return result; > } > > -/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 1, 0\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 1, \&\"temp1\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 1, \&\"temp2\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 1, \&\"temp3\"" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-5.c b/gcc/testsuite/c-c++-common/auto-init-5.c > index 9c98a6e7ab2..9c4de612182 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-5.c > +++ b/gcc/testsuite/c-c++-common/auto-init-5.c > @@ -15,7 +15,7 @@ _Complex long double foo() > return result; > } > > -/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 2, 0\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 2, \&\"temp1\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 2, \&\"temp2\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 2, \&\"temp3\"" "gimple" } } */ > > diff --git a/gcc/testsuite/c-c++-common/auto-init-6.c b/gcc/testsuite/c-c++-common/auto-init-6.c > index 3fe24562ebb..6a406447f3d 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-6.c > +++ b/gcc/testsuite/c-c++-common/auto-init-6.c > @@ -15,7 +15,7 @@ _Complex long double foo() > return result; > } > > -/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 1, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 1, 0\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 1, \&\"temp1\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 1, \&\"temp2\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 1, \&\"temp3\"" "gimple" } } */ > > diff --git a/gcc/testsuite/c-c++-common/auto-init-7.c b/gcc/testsuite/c-c++-common/auto-init-7.c > index 19986969a8f..b44dd5e68ed 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-7.c > +++ b/gcc/testsuite/c-c++-common/auto-init-7.c > @@ -29,7 +29,7 @@ double foo() > return result; > } > > -/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(12, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(24, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(28, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(12, 2, \&\"temp1\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(24, 2, \&\"temp2\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(28, 2, \&\"temp3\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(8, 2, \&\"temp4\"" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-8.c b/gcc/testsuite/c-c++-common/auto-init-8.c > index 9778e911e3a..739ac028931 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-8.c > +++ b/gcc/testsuite/c-c++-common/auto-init-8.c > @@ -29,7 +29,7 @@ double foo() > return result; > } > > -/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(12, 1, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(24, 1, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(28, 1, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(12, 1, \&\"temp1\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(24, 1, \&\"temp2\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(28, 1, \&\"temp3\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(8, 1, \&\"temp4\"" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-9.c b/gcc/testsuite/c-c++-common/auto-init-9.c > index 29acb7f8669..113107ffd5c 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-9.c > +++ b/gcc/testsuite/c-c++-common/auto-init-9.c > @@ -16,5 +16,5 @@ void foo() > return; > } > > -/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(2, 2, 0\\)" "gimple" } } */ > -/* { dg-final { scan-tree-dump-not "temp2 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(2, 2, \&\"temp1\"" "gimple" } } */ > +/* { dg-final { scan-tree-dump-not "temp2 = .DEFERRED_INIT \\(8, 2, \&\"temp2\"" "gimple" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-esra.c b/gcc/testsuite/c-c++-common/auto-init-esra.c > index 77ec02355df..ce6779f20fc 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-esra.c > +++ b/gcc/testsuite/c-c++-common/auto-init-esra.c > @@ -1,6 +1,6 @@ > /* Verify the strength reduction adjustment for -ftrivial-auto-var-init. */ > /* { dg-do compile } */ > -/* { dg-options "-O2 -ftrivial-auto-var-init=zero -fdump-tree-gimple -fdump-tree-esra" } */ > +/* { dg-options "-O2 -ftrivial-auto-var-init=zero -fno-PIC -fdump-tree-gimple -fdump-tree-esra" } */ > > > typedef double VECTOR[3]; > @@ -31,5 +31,5 @@ void VCross(VECTOR a, const VECTOR b, const VECTOR c) > Assign_Vector(a, tmp); > } > > -/* { dg-final { scan-tree-dump-times "tmp = .DEFERRED_INIT \\(24, 2, 0\\)" 1 "gimple" } } */ > -/* { dg-final { scan-tree-dump-times ".DEFERRED_INIT \\(8, 2, 0\\)" 3 "esra" } } */ > +/* { dg-final { scan-tree-dump-times "tmp = .DEFERRED_INIT \\(24, 2, \&\"tmp\"" 1 "gimple" } } */ > +/* { dg-final { scan-tree-dump-times ".DEFERRED_INIT \\(8, 2, \&\"tmp\"" 3 "esra" } } */ > diff --git a/gcc/testsuite/c-c++-common/auto-init-padding-1.c b/gcc/testsuite/c-c++-common/auto-init-padding-1.c > index 83db8dde832..d2e322717f0 100644 > --- a/gcc/testsuite/c-c++-common/auto-init-padding-1.c > +++ b/gcc/testsuite/c-c++-common/auto-init-padding-1.c > @@ -19,5 +19,5 @@ void foo(int a) > g(s); > } > > -/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(24, 1, 0\\)" "gimple" } } */ > +/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(24, 1, \&\"s\"" "gimple" } } */ > /* { dg-final { scan-tree-dump "__builtin_clear_padding" "gimple" } } */ > diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-16.c b/gcc/testsuite/gcc.dg/auto-init-uninit-16.c > index 38e19502a67..f14864be901 100644 > --- a/gcc/testsuite/gcc.dg/auto-init-uninit-16.c > +++ b/gcc/testsuite/gcc.dg/auto-init-uninit-16.c > @@ -1,7 +1,5 @@ > /* { dg-do compile } */ > /* { dg-options "-O2 -Wuninitialized -ftrivial-auto-var-init=zero" } */ > -/* -ftrivial-auto-var-init will make the uninitialized warning for address > - taken auto var going away, FIXME later. */ > > int foo, bar; > > @@ -20,6 +18,6 @@ void testfunc() > > decode_reloc(foo, &alt_reloc); > > - if (alt_reloc) /* { dg-warning "may be used uninitialized" "" { xfail *-*-* } } */ > + if (alt_reloc) /* { dg-warning "may be used uninitialized" "" } */ > bar = 42; > } > diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-34.c b/gcc/testsuite/gcc.dg/auto-init-uninit-34.c > index 1a687654ebb..d6e7ed3e860 100644 > --- a/gcc/testsuite/gcc.dg/auto-init-uninit-34.c > +++ b/gcc/testsuite/gcc.dg/auto-init-uninit-34.c > @@ -4,8 +4,6 @@ > to functions declared with attribute access is diagnosed where expected. > { dg-do compile } > { dg-options "-O -Wall -ftrivial-auto-var-init=zero" } */ > -/* -ftrivial-auto-var-init will make the uninitialized warning for address > - taken auto var going away, FIXME later. */ > > #define RW(...) __attribute__ ((access (read_write, __VA_ARGS__))) > > @@ -21,10 +19,10 @@ void nowarn_scalar (void) > > void warn_scalar_1 (void) > { > - int i1; // { dg-message "declared here" "" { xfail *-*-* } } > + int i1; // { dg-message "declared here" "" } > int i2, i3 = 1, i4; > > - f4pi (&i1, &i2, &i3, &i4); // { dg-warning "'i1' may be used uninitialized" "" { xfail *-*-* } } > + f4pi (&i1, &i2, &i3, &i4); // { dg-warning "'i1' may be used uninitialized" "" } > } > > void warn_scalar_2 (void) > @@ -32,7 +30,7 @@ void warn_scalar_2 (void) > int j1 = 0, j2, j4; > int j3; > > - f4pi (&j1, &j2, &j3, &j4); // { dg-warning "'j3' may be used uninitialized" "" { xfail *-*-* } } > + f4pi (&j1, &j2, &j3, &j4); // { dg-warning "'j3' may be used uninitialized" "" } > } > > > diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-37.c b/gcc/testsuite/gcc.dg/auto-init-uninit-37.c > index 2791b37ca00..aea554262f8 100644 > --- a/gcc/testsuite/gcc.dg/auto-init-uninit-37.c > +++ b/gcc/testsuite/gcc.dg/auto-init-uninit-37.c > @@ -5,8 +5,6 @@ > arguments of array, VLA, or pointer types. > { dg-do compile } > { dg-options "-O2 -Wall -ftrack-macro-expansion=0 -ftrivial-auto-var-init=zero" } */ > -/* -ftrivial-auto-var-init will make the uninitialized warning for address > - taken auto var going away, FIXME later. */ > > #define NONE /* none */ > #define RO(...) __attribute__ ((access (read_only, __VA_ARGS__))) > @@ -42,9 +40,9 @@ typedef int IA_[]; > typedef const int CIA_[]; > > T1 (NONE, fia_, IA_); > -T1 (NONE, fcia_, CIA_); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > -T1 (RO (1), froia_, IA_); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } } > -T1 (RW (1), frwia_, IA_); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > +T1 (NONE, fcia_, CIA_); // { dg-warning "\\\[-Wmaybe-uninitialized" "" } > +T1 (RO (1), froia_, IA_); // { dg-warning "\\\[-Wuninitialized" "" } > +T1 (RW (1), frwia_, IA_); // { dg-warning "\\\[-Wmaybe-uninitialized" "" } > T1 (WO (1), fwoia_, IA_); > T1 (X (1), fxia_, IA_); > > @@ -53,9 +51,9 @@ typedef int IA1[1]; > typedef const int CIA1[1]; > > T1 (NONE, fia1, IA1); > -T1 (NONE, fcia1, CIA1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > -T1 (RO (1), froia1, IA1); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } } > -T1 (RW (1), frwia1, IA1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > +T1 (NONE, fcia1, CIA1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" } > +T1 (RO (1), froia1, IA1); // { dg-warning "\\\[-Wuninitialized" "" } > +T1 (RW (1), frwia1, IA1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" } > T1 (WO (1), fwoia1, IA1); > T1 (X (1), fxia1, IA1); > > @@ -64,9 +62,9 @@ T1 (X (1), fxia1, IA1); > #define CIARS1 const int[restrict static 1] > > T1 (NONE, fiars1, IARS1); > -T1 (NONE, fciars1, CIARS1);// { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > -T1 (RO (1), froiars1, IARS1); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } } > -T1 (RW (1), frwiars1, IARS1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > +T1 (NONE, fciars1, CIARS1);// { dg-warning "\\\[-Wmaybe-uninitialized" "" } > +T1 (RO (1), froiars1, IARS1); // { dg-warning "\\\[-Wuninitialized" "" } > +T1 (RW (1), frwiars1, IARS1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" } > T1 (WO (1), fwoiars1, IARS1); > T1 (X (1), fxiars1, IARS1); > > @@ -75,9 +73,9 @@ T1 (X (1), fxiars1, IARS1); > #define CIAS1 const int[static 1] > > T1 (NONE, fias1, IAS1); > -T1 (NONE, fcias1, CIAS1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > -T1 (RO (1), froias1, IAS1); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } } > -T1 (RW (1), frwias1, IAS1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > +T1 (NONE, fcias1, CIAS1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" } > +T1 (RO (1), froias1, IAS1); // { dg-warning "\\\[-Wuninitialized" "" } > +T1 (RW (1), frwias1, IAS1); // { dg-warning "\\\[-Wmaybe-uninitialized" "" } > T1 (WO (1), fwoias1, IAS1); > T1 (X (1), fxias1, IAS1); > > @@ -86,9 +84,9 @@ T1 (X (1), fxias1, IAS1); > #define CIAX const int[*] > > T1 (NONE, fiax, IAX); > -T1 (NONE, fciax, CIAX); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > -T1 (RO (1), froiax, IAX); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } } > -T1 (RW (1), frwiax, IAX); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > +T1 (NONE, fciax, CIAX); // { dg-warning "\\\[-Wmaybe-uninitialized" "" } > +T1 (RO (1), froiax, IAX); // { dg-warning "\\\[-Wuninitialized" "" } > +T1 (RW (1), frwiax, IAX); // { dg-warning "\\\[-Wmaybe-uninitialized" "" } > T1 (WO (1), fwoiax, IAX); > T1 (X (1), fxiax, IAX); > > @@ -97,9 +95,9 @@ T1 (X (1), fxiax, IAX); > #define CIAN int n, const int[n] > > T2 (NONE, fian, IAN); > -T2 (NONE, fcian, CIAN); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > -T2 (RO (2, 1), froian, IAN); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } } > -T2 (RW (2, 1), frwian, IAN); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > +T2 (NONE, fcian, CIAN); // { dg-warning "\\\[-Wmaybe-uninitialized" "" } > +T2 (RO (2, 1), froian, IAN); // { dg-warning "\\\[-Wuninitialized" "" } > +T2 (RW (2, 1), frwian, IAN); // { dg-warning "\\\[-Wmaybe-uninitialized" "" } > T2 (WO (2, 1), fwoian, IAN); > T2 (X (2, 1), fxian, IAN); > > @@ -108,9 +106,9 @@ typedef int* IP; > typedef const int* CIP; > > T1 (NONE, fip, IP); > -T1 (NONE, fcip, CIP); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > -T1 (RO (1), froip, IP); // { dg-warning "\\\[-Wuninitialized" "" { xfail *-*-* } } > -T1 (RW (1), frwip, IP); // { dg-warning "\\\[-Wmaybe-uninitialized" "" { xfail *-*-* } } > +T1 (NONE, fcip, CIP); // { dg-warning "\\\[-Wmaybe-uninitialized" "" } > +T1 (RO (1), froip, IP); // { dg-warning "\\\[-Wuninitialized" "" } > +T1 (RW (1), frwip, IP); // { dg-warning "\\\[-Wmaybe-uninitialized" "" } > T1 (WO (1), fwoip, IP); > T1 (X (1), fxip, IP); > > diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-B.c b/gcc/testsuite/gcc.dg/auto-init-uninit-B.c > index b6d3efdfb88..40d3196ea47 100644 > --- a/gcc/testsuite/gcc.dg/auto-init-uninit-B.c > +++ b/gcc/testsuite/gcc.dg/auto-init-uninit-B.c > @@ -1,7 +1,5 @@ > /* Origin: PR c/179 from Gray Watson , adapted as a testcase > by Joseph Myers . */ > -/* -ftrivial-auto-var-init will make the uninitialized warning for address > - taken auto var going away, FIXME later. */ > /* { dg-do compile } */ > /* { dg-options "-O2 -Wuninitialized -ftrivial-auto-var-init=zero" } */ > extern void foo (int *); > @@ -11,7 +9,7 @@ void > baz (void) > { > int i; > - if (i) /* { dg-warning "is used uninitialized" "uninit i warning" { xfail *-*-* } } */ > + if (i) /* { dg-warning "is used uninitialized" "uninit i warning" } */ > bar (i); > foo (&i); > } > diff --git a/gcc/testsuite/gcc.target/aarch64/auto-init-2.c b/gcc/testsuite/gcc.target/aarch64/auto-init-2.c > index 2c54e6d6038..375befd325b 100644 > --- a/gcc/testsuite/gcc.target/aarch64/auto-init-2.c > +++ b/gcc/testsuite/gcc.target/aarch64/auto-init-2.c > @@ -32,4 +32,4 @@ void foo() > /* { dg-final { scan-rtl-dump-times "0xfe\\\]" 1 "expand" } } */ > /* { dg-final { scan-rtl-dump-times "0xfffffffffffffefe" 1 "expand" } } */ > /* { dg-final { scan-rtl-dump-times "0xfffffffffefefefe" 2 "expand" } } */ > -/* { dg-final { scan-rtl-dump-times "0xfefefefefefefefe" 2 "expand" } } */ > +/* { dg-final { scan-rtl-dump-times "0xfefefefefefefefe" 3 "expand" } } */ > diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c > index ebbd894ae03..0299a1fd197 100644 > --- a/gcc/tree-cfg.c > +++ b/gcc/tree-cfg.c > @@ -3455,19 +3455,14 @@ verify_gimple_call (gcall *stmt) > } > > /* For a call to .DEFERRED_INIT, > - LHS = DEFERRED_INIT (SIZE of the DECL, INIT_TYPE, IS_VLA) > - we should guarantee that the 1st and the 3rd arguments are consistent: > - 1st argument: SIZE of the DECL; > - 3rd argument: IS_VLA, 0 NO, 1 YES; > + LHS = DEFERRED_INIT (SIZE of the DECL, INIT_TYPE, NAME of the DECL) > + we should guarantee that when the 1st argument is a constant, it should > + be the same as the size of the LHS. */ > > - if IS_VLA is false, the 1st argument should be a constant and the same as > - the size of the LHS. */ > if (gimple_call_internal_p (stmt, IFN_DEFERRED_INIT)) > { > tree size_of_arg0 = gimple_call_arg (stmt, 0); > tree size_of_lhs = TYPE_SIZE_UNIT (TREE_TYPE (lhs)); > - tree is_vla_node = gimple_call_arg (stmt, 2); > - bool is_vla = (bool) TREE_INT_CST_LOW (is_vla_node); > > if (TREE_CODE (lhs) == SSA_NAME) > lhs = SSA_NAME_VAR (lhs); > @@ -3477,27 +3472,13 @@ verify_gimple_call (gcall *stmt) > &size_from_arg0); > bool is_constant_size_lhs = poly_int_tree_p (size_of_lhs, > &size_from_lhs); > - if (!is_vla) > - { > - if (!is_constant_size_arg0) > - { > - error ("% calls for non-VLA should have " > - "constant size for the first argument"); > - return true; > - } > - else if (!is_constant_size_lhs) > - { > - error ("% calls for non-VLA should have " > - "constant size for the LHS"); > - return true; > - } > - else if (maybe_ne (size_from_arg0, size_from_lhs)) > - { > - error ("% calls for non-VLA should have same " > - "constant size for the first argument and LHS"); > - return true; > - } > - } > + if (is_constant_size_arg0 && is_constant_size_lhs) > + if (maybe_ne (size_from_arg0, size_from_lhs)) > + { > + error ("% calls should have same " > + "constant size for the first argument and LHS"); > + return true; > + } > } > > /* ??? The C frontend passes unpromoted arguments in case it > diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c > index 76e3aae405c..a96e725af67 100644 > --- a/gcc/tree-sra.c > +++ b/gcc/tree-sra.c > @@ -4123,7 +4123,7 @@ get_repl_default_def_ssa_name (struct access *racc, tree reg_type) > static void > generate_subtree_deferred_init (struct access *access, > tree init_type, > - tree is_vla, > + tree decl_name, > gimple_stmt_iterator *gsi, > location_t loc) > { > @@ -4135,7 +4135,7 @@ generate_subtree_deferred_init (struct access *access, > gimple *call > = gimple_build_call_internal (IFN_DEFERRED_INIT, 3, > TYPE_SIZE_UNIT (TREE_TYPE (repl)), > - init_type, is_vla); > + init_type, decl_name); > gimple_call_set_lhs (call, repl); > gsi_insert_before (gsi, call, GSI_SAME_STMT); > update_stmt (call); > @@ -4144,7 +4144,7 @@ generate_subtree_deferred_init (struct access *access, > } > if (access->first_child) > generate_subtree_deferred_init (access->first_child, init_type, > - is_vla, gsi, loc); > + decl_name, gsi, loc); > > access = access ->next_sibling; > } > @@ -4152,7 +4152,7 @@ generate_subtree_deferred_init (struct access *access, > } > > /* For a call to .DEFERRED_INIT: > - var = .DEFERRED_INIT (size_of_var, init_type, is_vla); > + var = .DEFERRED_INIT (size_of_var, init_type, name_of_var); > examine the LHS variable VAR and replace it with a scalar replacement if > there is one, also replace the RHS call to a call to .DEFERRED_INIT of > the corresponding scalar relacement variable. Examine the subtree and > @@ -4164,7 +4164,7 @@ sra_modify_deferred_init (gimple *stmt, gimple_stmt_iterator *gsi) > { > tree lhs = gimple_call_lhs (stmt); > tree init_type = gimple_call_arg (stmt, 1); > - tree is_vla = gimple_call_arg (stmt, 2); > + tree decl_name = gimple_call_arg (stmt, 2); > > struct access *lhs_access = get_access_for_expr (lhs); > if (!lhs_access) > @@ -4185,7 +4185,7 @@ sra_modify_deferred_init (gimple *stmt, gimple_stmt_iterator *gsi) > > if (lhs_access->first_child) > generate_subtree_deferred_init (lhs_access->first_child, > - init_type, is_vla, gsi, loc); > + init_type, decl_name, gsi, loc); > if (lhs_access->grp_covered) > { > unlink_stmt_vdef (stmt); > diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c > index 1df0bcc42c0..85d1ba866fc 100644 > --- a/gcc/tree-ssa-uninit.c > +++ b/gcc/tree-ssa-uninit.c > @@ -182,9 +182,22 @@ warn_uninit (opt_code opt, tree t, tree var, const char *gmsgid, > } > > /* Anonymous SSA_NAMEs shouldn't be uninitialized, but ssa_undefined_value_p > - can return true if the def stmt of an anonymous SSA_NAME is COMPLEX_EXPR > - created for conversion from scalar to complex. Use the underlying var of > - the COMPLEX_EXPRs real part in that case. See PR71581. */ > + can return true if the def stmt of an anonymous SSA_NAME is > + 1. A COMPLEX_EXPR created for conversion from scalar to complex. Use the > + underlying var of the COMPLEX_EXPRs real part in that case. See PR71581. > + > + 2. A call to .DEFERRED_INIT internal function. Since the original variable > + has been eliminated by optimziation, we need to get the variable name, > + and variable declaration location from this call. At the same time, we > + should use the temporary variable that was created to replace the original > + variable as a placeholder to record the information on whether the warning > + message for the variable has been issued or not. */ > + > + tree var_name = NULL_TREE; > + const char *var_name_str = NULL; > + location_t var_decl_loc = UNKNOWN_LOCATION; > + tree repl_var = NULL_TREE; > + > if (!var && !SSA_NAME_VAR (t)) > { > gimple *def_stmt = SSA_NAME_DEF_STMT (t); > @@ -197,9 +210,34 @@ warn_uninit (opt_code opt, tree t, tree var, const char *gmsgid, > && zerop (gimple_assign_rhs2 (def_stmt))) > var = SSA_NAME_VAR (v); > } > + > + if (gimple_call_internal_p (def_stmt, IFN_DEFERRED_INIT)) > + { > + /* Get the variable name from the 3rd argument of call. */ > + var_name = gimple_call_arg (def_stmt, 2); > + var_name = TREE_OPERAND (TREE_OPERAND (var_name, 0), 0); > + var_name_str = TREE_STRING_POINTER (var_name); > + > + if (is_gimple_assign (context) > + && TREE_CODE (gimple_assign_lhs (context)) == VAR_DECL > + && DECL_NAME (gimple_assign_lhs (context)) > + && IDENTIFIER_POINTER (DECL_NAME (gimple_assign_lhs (context)))) > + if (strcmp > + (IDENTIFIER_POINTER (DECL_NAME (gimple_assign_lhs (context))), > + var_name_str) == 0) For what it's worth, although the style in GCC is pervasive of repeating the same expression in operands of subsequent subexpressions of a logical exoression, I think it gets more and more difficult to read as the expression become increasingly deeply nested. I find it far more readable when temporaries are added for the subexpressions (if it makes the nesting too deep I take it as a sign that the logic might be better factored out into a helper function). > + return; > + > + /* Get the variable declaration location from the def_stmt. */ > + var_decl_loc = gimple_location (def_stmt); > + > + /* The LHS of the call is a temporary variable, we use it as a > + placeholder to record the information on whether the warning > + has been issued or not. */ > + repl_var = gimple_call_lhs (def_stmt); > + } > } > > - if (var == NULL_TREE) > + if (var == NULL_TREE && var_name == NULL_TREE) > return; > > /* Avoid warning if we've already done so or if the warning has been > @@ -207,36 +245,56 @@ warn_uninit (opt_code opt, tree t, tree var, const char *gmsgid, > if (((warning_suppressed_p (context, OPT_Wuninitialized) > || (gimple_assign_single_p (context) > && get_no_uninit_warning (gimple_assign_rhs1 (context))))) > - || get_no_uninit_warning (var)) > + || (var && get_no_uninit_warning (var)) > + || (repl_var && get_no_uninit_warning (repl_var))) > return; > > /* Use either the location of the read statement or that of the PHI > argument, or that of the uninitialized variable, in that order, > whichever is valid. */ > - location_t location; > + location_t location = UNKNOWN_LOCATION; > if (gimple_has_location (context)) > location = gimple_location (context); > else if (phi_arg_loc != UNKNOWN_LOCATION) > location = phi_arg_loc; > - else > + else if (var) > location = DECL_SOURCE_LOCATION (var); > + else if (var_name) > + location = var_decl_loc; > + > location = linemap_resolve_location (line_table, location, > LRK_SPELLING_LOCATION, NULL); > > auto_diagnostic_group d; > - if (!warning_at (location, opt, gmsgid, var)) > + char *gmsgid_final = XNEWVEC (char, strlen (gmsgid) + 5); > + gmsgid_final[0] = 0; > + if (var) > + strcat (gmsgid_final, "%qD "); > + else if (var_name) > + strcat (gmsgid_final, "%qs "); > + strcat (gmsgid_final, gmsgid); > + > + if (var && !warning_at (location, opt, gmsgid_final, var)) > + return; > + else if (var_name && !warning_at (location, opt, gmsgid_final, var_name_str)) > return; Dynamically creating the string seems quite cumbersome here, and it leaks the allocated block. I wonder if it might be better to remove the gmsgid argument from the function and assign it to one of the literals based on the other arguments. Since only one of var and var_name is used, I also wonder if the %qs form could be used for both to simplify the overall logic. (I.e., get the IDENTIFIER_POINTER string from var and use it instead of %qD). Martin > > /* Avoid subsequent warnings for reads of the same variable again. */ > - suppress_warning (var, opt); > + if (var) > + suppress_warning (var, opt); > + else if (repl_var) > + suppress_warning (repl_var, opt); > > /* Issue a note pointing to the read variable unless the warning > is at the same location. */ > - location_t var_loc = DECL_SOURCE_LOCATION (var); > + location_t var_loc = var ? DECL_SOURCE_LOCATION (var) : var_decl_loc; > if (location == var_loc) > return; > > - inform (var_loc, "%qD was declared here", var); > + if (var) > + inform (var_loc, "%qD was declared here", var); > + else if (var_name) > + inform (var_loc, "%qs was declared here", var_name_str); > } > > struct check_defs_data > @@ -380,6 +438,20 @@ check_defs (ao_ref *ref, tree vdef, void *data_) > if (gimple_call_internal_p (def_stmt, IFN_DEFERRED_INIT)) > return false; > > + /* For address taken variable, a temporary variable is added between > + the variable and the call to .DEFERRED_INIT function as: > + _1 = .DEFERRED_INIT (4, 2, &"i1"[0]); > + i1 = _1; > + Ignore this vdef as well. */ > + if (is_gimple_assign (def_stmt) > + && gimple_assign_rhs_code (def_stmt) == SSA_NAME) > + { > + tree tmp_var = gimple_assign_rhs1 (def_stmt); > + if (gimple_call_internal_p (SSA_NAME_DEF_STMT (tmp_var), > + IFN_DEFERRED_INIT)) > + return false; > + } > + > /* The ASAN_MARK intrinsic doesn't modify the variable. */ > if (is_gimple_call (def_stmt)) > { > @@ -878,7 +950,7 @@ warn_uninit_phi_uses (basic_block bb) > } > if (use_stmt) > warn_uninit (OPT_Wuninitialized, def, SSA_NAME_VAR (def), > - "%qD is used uninitialized", use_stmt); > + "is used uninitialized", use_stmt); > } > } > > @@ -932,10 +1004,10 @@ warn_uninitialized_vars (bool wmaybe_uninit) > tree use = USE_FROM_PTR (use_p); > if (wlims.always_executed) > warn_uninit (OPT_Wuninitialized, use, SSA_NAME_VAR (use), > - "%qD is used uninitialized", stmt); > + "is used uninitialized", stmt); > else if (wmaybe_uninit) > warn_uninit (OPT_Wmaybe_uninitialized, use, SSA_NAME_VAR (use), > - "%qD may be used uninitialized", stmt); > + "may be used uninitialized", stmt); > } > > /* For limiting the alias walk below we count all > @@ -1182,7 +1254,7 @@ warn_uninitialized_phi (gphi *phi, vec *worklist, > > warn_uninit (OPT_Wmaybe_uninitialized, uninit_op, > SSA_NAME_VAR (uninit_op), > - "%qD may be used uninitialized in this function", > + "may be used uninitialized in this function", > uninit_use_stmt, loc); > } > >