From patchwork Tue Dec 7 15:36:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qing Zhao X-Patchwork-Id: 1564764 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=BCh1xhkl; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J7kth3kB5z9s3q for ; Wed, 8 Dec 2021 02:36:58 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EB4C3385841F for ; Tue, 7 Dec 2021 15:36:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB4C3385841F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1638891416; bh=E3pZh6/MJQRoiXs7YDeVT1dCIvcdlkrYPHsfc7zGt0Y=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=BCh1xhklYT45naVhhmkm2u6g0QcvniUIEPD2fFJ1sqDhBewad4RTdivvi8uJJO/V2 Xw+bZfoodGrAyyjHOSGsWd1HkpihJG43fk0c7qg34xpbqvY2eEI9Z+eU68pkHYhPaB ca6TLURMyjVKfYQBPfdhDJesAYXHZPjFtk+hgs5s= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id A7EAC3858C60 for ; Tue, 7 Dec 2021 15:36:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A7EAC3858C60 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1B7FKwO4004493; Tue, 7 Dec 2021 15:36:29 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3csdfjdjxb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Dec 2021 15:36:28 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 1B7FZGBM050185; Tue, 7 Dec 2021 15:36:28 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by aserp3030.oracle.com with ESMTP id 3csc4te80c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Dec 2021 15:36:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P4huKSrtKoDSTatjdTZ/ZnOoLfHqW+rEDh7fENzmEe7Az1YV6tfmrOk5YuNkT5LtDZz5TYNLlkf05SPop9u/112JU68xZruTT3vdgB0myWSs5AiEd9M/DwGAZ3eOqb0MwUYnWbO8prCrBL0gFD14jg++i2W8rF1JjOXqY/y+KS+D6ixScVa+mGeeBdNbJ1P9wnUu7Yf+l6akk2k1CCpw17dsBkYaYhzAH4QZ/X0B3HrAkRIDyOL+Nl1SsjPQlnUsmCMb0brRpcnwrmKWQAErK6lcwtASL8iop/F4fNbKXiLhkavartXnqKAf2AVyT7rG/tNIVr1qtyaubDgOCX0aFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=E3pZh6/MJQRoiXs7YDeVT1dCIvcdlkrYPHsfc7zGt0Y=; b=Pt/QPjEm4CqGiAIO+StMjMlI2BKio2+mlwQuUQIhfzydofdwtPIs7DfwTt1ML+qJcOykYHPWDXS99n+o3MKZNajHMFU6lqvQh1MYYBEi8cBpqobCurUN8M23XGdwvh+5NryCsnWJ4jPf/lUQbCYGiD1Jj639hGQZUwu58Rtqu/RWGkjNeBZ3lakk8TKQVxikXRTXFcz3dNI7PlXNK8Md/gFdGYUUedP0FI49P++WJBNirjdo77AERst7oDw6KVCBtwmDyr4O/fzYQXWU5/vAbie6Ck6WX2dsnzcsW61LxpeglztpvZEbL6MhPptjTFN2lLyiWT+Tz1hNe6kLgMoGaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from CH2PR10MB4344.namprd10.prod.outlook.com (2603:10b6:610:af::19) by CH0PR10MB5323.namprd10.prod.outlook.com (2603:10b6:610:c6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16; Tue, 7 Dec 2021 15:36:24 +0000 Received: from CH2PR10MB4344.namprd10.prod.outlook.com ([fe80::8dd2:f5a2:23e8:1a7c]) by CH2PR10MB4344.namprd10.prod.outlook.com ([fe80::8dd2:f5a2:23e8:1a7c%8]) with mapi id 15.20.4755.022; Tue, 7 Dec 2021 15:36:24 +0000 To: richard Biener Subject: [Patch]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables Thread-Topic: [Patch]Enable -Wuninitialized + -ftrivial-auto-var-init for address taken variables Thread-Index: AQHX64Ax2tTp6krLmEOZUMsMv2r9oQ== Date: Tue, 7 Dec 2021 15:36:24 +0000 Message-ID: <53205959-8D66-47D8-B88C-8B1D65B5D008@oracle.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3608.120.23.2.7) x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 74c5e5b9-57d3-41bf-aa06-08d9b99753e2 x-ms-traffictypediagnostic: CH0PR10MB5323:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:534; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nCwo3kNx3W05YLmJgISihnhe88yHXQjx28ztrxFL0DPfqSiaGqmxVjyWmubEgxAgmoEScV8tEmQkIrE29i9WdFGi67/VVvj5IAbHQTdRUfNDnQV18YNgrjNhVhtSo4c91dEQ26LFh3qPEtRrEpqBdXmHaBIFVACglgUPCz+t/nGqp7jWFJXQ6jwJkJGJ5RTftGv2iJ80hrGab/2wCPf9cZTthvkE+is+4hccLrdBo2cdz2aN9arkyQXYfqllXOgLqAw/h/IbW/eSB9hYDqqGjGdcdxQ11mPrnIPmC7ysS2HL5q6uY/O9muUUvT1HzAjvbjNpa5URjNK762OyH8xt36X1C7O2WUEyNcA9dmlrQVyjCCyPhrsehO60vhMk54oX5CUBa2IYgLAvaUgskmd7K8BE0/dCOBagNG/sV6yG7nWCOmb9X23WeJxPyhcYfKR4+rh9iRb+WduDtF4HV04L4JJrqOii687fbL0ZwTBU495tJda3sSYfs4dhhidfRdM2wfVR/wJAGMsLpHLQc5nB4WcjR5f3OqdagsDuKj3WW+hOBxOsaEAsHQ1WaVFniSHo8j4Xe3JeA5RWgxPm6W8XHc+CWUm28w9UZ+seB4yUVoY10E6ZSFYbUub1bs7k9cyz3+cCvjTGlKgE5OQvSeXlpapLqaY2W1MtkUfvUZJtNtnFogsiL8PuvBnYpr4pcg0utRrmH37aeapneJtJyCBRFXG3pTnskoMZqNaTePpStH0iv1T1TBAIbmmO5Aunu4SFuAygHtZQG4Vq468Rg58d6eKP8dWoWM4ZN8+0yXusL4ScxHtG+WTVY0z1mHn6qu8tcLq8Qh9mH5q+x5zZFiTBKg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR10MB4344.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(316002)(6506007)(53546011)(38070700005)(86362001)(6512007)(71200400001)(33656002)(5660300002)(36756003)(83380400001)(508600001)(186003)(4326008)(44832011)(66446008)(6486002)(6916009)(2616005)(30864003)(8676002)(2906002)(84970400001)(91956017)(76116006)(38100700002)(26005)(66946007)(122000001)(66556008)(66476007)(64756008)(8936002)(45980500001)(559001)(579004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: /rDVijtWNyvpfxT0Ht+rg6tIygBs5C1jAkRiLhhVl96OzTycXS4m+p+zFkP8J7GgTT9r3OK+wLDbx+BVS9cLs7XwSD0kjR9w6PM++kTua5tUrgu4EnWOmQQtK7n/nF4OKqdYoPGMPLcmBsNcEYUPkOB+9l05vIAJkzoiUsgc582Qv5IsYPKMIHWTRM2PHDmeqqm649i2jj1Ve6fJgkVfxOSXN74uHwhHqB6Wd2mg1zaFi/da9DLdc0z7NaD7mYZyB0fHDTNXldjwFRrXlIt2nR6BF0HDtDVbWzQ9p6AarEpleoQBNAILb78YV+HTB6hNsz/mTDoI/JySR25nRy57yE3nubNXyOMXLojG7NY8m16WWJa7TeUZQdwqtNqju2uRQAwhBQfJD0+/8aSistjTTvWGdxk3VPSUfRGCKj92P7ztXn1Tfyv+DQRmgYsRyPZqY/FoNssvgLWJhOo6WD7eDKFY/fAvzOg628RCBCNZLXlf2xzfYSOBPAts6UKyuVAEXGOkD1hmtzkLSHNyCkJEHBmdSWhk4kP2GQAYmC98YV9oKuZh2Efi9BhrRflouk8HFcdui100Vna3TIqm7mco1C1J92DhaML4rlvDvG9AK/8yLEQY9qcwMvEnuoBm7iODScrWJYNkQXNK3nXrLQwe+Sc2A0EGP4/ZYHfVKs3XfvRVIstTWqVZnY4/m1wabbISgGokd7KbTSK6fkPLslWMy5tBj4wkBWUNQvrrFjynYFiwt1X1BKX8o7g6RiwK1AkA8NkpayuBG8QG3sLncSq5AOVxLfX0GACbwS37t0fJJAmKoiZXr5VzWgIm2TgNfkw1xilYmmM1Wb8WmfR9aM8e3W9GLLh7BUe4yj4F2x0HUpYkzJoFWVch8wfPqKqfh+awvveEAGd5JJXEr+LHWuhwZ4EJu8VR8oEvdTzS675ExoTYlB56jMNPFFQ1LEoWJSAtzvCo8OLBsedKH8o7O0xMutl1qIwdFD4H6KMWph37gl/Hfi9ziNEnJZABE2DNNvbhA0mc74IQ+t4DNRBUl1cPj9xAAGhAPfjrOx4XmhJ4r294ZJa+obfGmidLXzV67Oiluedxss7/I43rEZ1t5MICMEyllEnzkle+6SOcjPfZQ4uFlwxVj0LSNUFYbQZiygv/bWwLVbk0n7Ll8T2DYDB9Gl3c30mPnsl3xhe5cYDZ0BUpRjvTJUcg4OPkFScQjk7tIGLs6zJG2VSNbwoSIOp3xd7pRqN4jVr6ixMEPCKt8awjvcIJyqSVJdQPjt0Pse4EVOoOn3J+0ID2XrNtF0jKrhQOOB780xgQgiuaoTQ011Dgid7CrfoIcZzyWGkr6MMBuOCROHjKhekBTn+fAY1XWH6jNLTK5hUObqyb7iId4CzdSLGqHc18qdj6fnaMlAfj6nLnldc+eS70CCu5ndPRHalMJG1Q7ehbBbctV2Dcybk8+zBcHxuvsOnSKRA5tpi9rFY6dSs0eWygMNeTHqtjL/1J3b598JBjIH08i2nVIdEXZ5FDZ5gEZ/lvxGFOrpdd1DPNLTUabhDHKGdp5yB+cg0hz/1gYSGrQy4rBj7eOpRZDjQCTKMOxYrF9IXB3ar9CrmC2/Fa+pbSvnb9drqLcdBdlksy0o6bp7xYu1XEd5I= Content-ID: <9737D547D841DE41AEF144E053FE13C8@namprd10.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH2PR10MB4344.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74c5e5b9-57d3-41bf-aa06-08d9b99753e2 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Dec 2021 15:36:24.6138 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 7grXKOn7/8lTt+xWwAavuCqi2spKHn2aMf1LGBNzmLIyL9oi9a9xtDggt3yeZU2WTwMLB83dXzZ/3Q3uqzFUgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5323 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10190 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112070095 X-Proofpoint-GUID: jSirIMrkWjyUcLrLp_5e4gcCd2a-nqEX X-Proofpoint-ORIG-GUID: jSirIMrkWjyUcLrLp_5e4gcCd2a-nqEX X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_FILL_THIS_FORM_SHORT 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-Patchwork-Original-From: Qing Zhao via Gcc-patches From: Qing Zhao Reply-To: Qing Zhao Cc: gcc Patches Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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? 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) + 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; /* 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); }