From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by sourceware.org (Postfix) with ESMTPS id 0EB003858D38 for ; Mon, 9 Jan 2023 07:57:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0EB003858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x132.google.com with SMTP id v25so11665195lfe.12 for ; Sun, 08 Jan 2023 23:57:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wvdc9WvEBU0uj+QY+PavSG0uq03bxjrgW4PevCpVKC8=; b=DSdIYuQ3aqgNFxhr2LhcyAJNcBcy7pGscY7+JS22wPuSaVf1LvkhFsTIB0dpOEGV8N MCWZL2iYjWzMjEzMjlgurP7YicnnA+flpaX/jhsAEEXrT1ULEUIpfgwhdWjgtOEAwWe1 YFYyLnYXgNsVLDJLYUN47/YIALuLmRFIjozFZHLvt68K+h1DVFywySzugYixOgl8Bntu ZqAgmYsNx5at9rt2qBSJg4GnMTOcSJyIrxKOKtqY3LkvPiG7pnEYCZV9azSCG1l2ifCM AmINKqf7Qmzs0QqZXDVCmZU7nXT2dmnGaQL7Hb7kqGzwe7ZcCb3MfwKDFZaigAg/QU9z 7GJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wvdc9WvEBU0uj+QY+PavSG0uq03bxjrgW4PevCpVKC8=; b=A1+dcCef0Dwp2F+Jc/6EcziRQfTtI6L9yPAdEv4LLYVJRmqgxSSAQCbd3tlWM24kG5 9ODbGKSWflZfSuZl2uJ6B2S2b7Zf2RjcxPoWjPG7bUTYyJSx8BNllC/HZbm4eZ8YoP1P CYLzaijPF6LQm92B2spH7HOTbGYeQyt2msvwiMieRbqaS0YEGuh7pEPGC/S9S2D4vf3I lNyV/tm4U7j1Bomp8dJK2F+9TkO4Wn5dBBhHy4h5FOYQqaBPfNFntt6+cVB0R/ZQxqc0 ZaWVIfkA8qGaaHVwPtY/guK6WBd2Qxx7IxPl1kQK8sjgmWvcaXEQCaGB9Sp6QMWjq8e/ cGiA== X-Gm-Message-State: AFqh2koImGVVbfnBJAGFf1Ye2558yo6KfJLqpQ6QvGstTHXH0kK6eM6D fM7CFaGPq1pdAJ7EiJXnYbnQRGt+Z3/oW2sAzE4= X-Google-Smtp-Source: AMrXdXujT+DrQi6M+P9I5tOVhsQDuSefXArmBiRqFDsES2Ns7TQxqmYisGF0Zo7b5OVkEupXOwQ0aBwUdN6UIoVeK5w= X-Received: by 2002:ac2:4a72:0:b0:4b6:f37c:c123 with SMTP id q18-20020ac24a72000000b004b6f37cc123mr4424952lfp.539.1673251057482; Sun, 08 Jan 2023 23:57:37 -0800 (PST) MIME-Version: 1.0 References: <20221202175225.2780-1-cupertino.miranda@oracle.com> <20221202175225.2780-2-cupertino.miranda@oracle.com> In-Reply-To: From: Richard Biener Date: Mon, 9 Jan 2023 08:57:24 +0100 Message-ID: Subject: Re: [PATCH 1/2] select .rodata for const volatile variables. To: Jeff Law Cc: Cupertino Miranda , gcc-patches@gcc.gnu.org, jose.marchesi@oracle.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Dec 5, 2022 at 7:07 PM Jeff Law via Gcc-patches wrote: > > > > On 12/2/22 10:52, Cupertino Miranda via Gcc-patches wrote: > > Changed target code to select .rodata section for 'const volatile' > > defined variables. > > This change is in the context of the bugzilla #170181. > > > > gcc/ChangeLog: > > > > v850.c(v850_select_section): Changed function. > I'm not sure this is safe/correct. ISTM that you need to look at the > underlying TREE_TYPE to check for const-volatile rather than > TREE_SIDE_EFFECTS. Just to quote tree.h: /* In any expression, decl, or constant, nonzero means it has side effects or reevaluation of the whole expression could produce a different value. This is set if any subexpression is a function call, a side effect or a reference to a volatile variable. In a ..._DECL, this is set only if the declaration said `volatile'. This will never be set for a constant. */ #define TREE_SIDE_EFFECTS(NODE) \ (NON_TYPE_CHECK (NODE)->base.side_effects_flag) so if exp is a decl then that's the volatile check. > Of secondary importance is the ChangeLog. Just saying "Changed > function" provides no real information. Something like this would be > better: > > * config/v850/v850.c (v850_select_section): Put const volatile > objects into read-only sections. > > > Jeff > > > > > > --- > > gcc/config/v850/v850.cc | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/gcc/config/v850/v850.cc b/gcc/config/v850/v850.cc > > index c7d432990ab..e66893fede4 100644 > > --- a/gcc/config/v850/v850.cc > > +++ b/gcc/config/v850/v850.cc > > @@ -2865,7 +2865,6 @@ v850_select_section (tree exp, > > { > > int is_const; > > if (!TREE_READONLY (exp) > > - || TREE_SIDE_EFFECTS (exp) > > || !DECL_INITIAL (exp) > > || (DECL_INITIAL (exp) != error_mark_node > > && !TREE_CONSTANT (DECL_INITIAL (exp))))