On 1/9/23 00:57, Richard Biener wrote:
On Mon, Dec 5, 2022 at 7:07 PM Jeff Law via Gcc-patches
<gcc-patches@gcc.gnu.org> 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.
Ah, then we can just use TREE_SIDE_EFFECTS for testing if a _DECL node
is volatile. So that concern is a non-issue. I think that was the only
concern with patch #1. I'll install it momentarily.
Jeff