https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97172

--- Comment #17 from Richard Biener <rguenth at gcc dot gnu.org> ---
Well - you're the first to add nontrivial (non-constant) trees to attributes. 
In GIMPLE all effects are supposed to be reflected in the IL and thus things
like
variable TYPE_SIZE or TYPE_MIN/MAX_VALUE are actually gimplified with code
generated during that inserted at the respective DECL_EXPR (which is where
gimplification is triggered from for the types).

Honestly I am not sure what you think you can do with arbitrary expressions
in an attribute down the GIMPLE pipeline given there's no connection to
actual variable values.  That said, the idea of sticking this additional
information in attributes in form of some random plain tree expressions
doesn't work.  You'd have to sanitize them at least if, say, expressions
based purely on other formal function arguments is what you are after.

That would for example be done by unsharing the expressions without locations
which you could try.  But for example the PR97133 case,

    attributes <tree_list 0x7fffea94d8e8
        purpose <identifier_node 0x7fffea937910 arg spec>
        value <tree_list 0x7fffea94d898
            value <string_cst 0x7fffea936860 constant "[$]\000">
            chain <tree_list 0x7fffea94d870
                value <eq_expr 0x7fffea94d758 type <integer_type 0x7fffea8105e8
int>
                    side-effects
                    arg:0 <c_maybe_const_expr 0x7fffea94d730 type <pointer_type
0x7fffea930c78>
                        side-effects
                        arg:0 <compound_expr 0x7fffea94d708 type <void_type
0x7fffea810f18 void>
                            side-effects arg:1 <bind_expr 0x7fffea949330>>
                        arg:1 <compound_literal_expr 0x7fffea936780 type
<pointer_type 0x7fffea930c78>
                            side-effects arg:0 <decl_expr 0x7fffea936760>>>
                    arg:1 <integer_cst 0x7fffea94f030 constant 0>

certainly is missing constant evaluation (I can bet whatever is supposed
to consume the access attributes gives up on the above anyway).
C_MAYBE_CONST_EXPR is a frontend specific tree code and thus it shouldn't
even survive GENERICization.

So I would stronly suggest to revisit the way you try to record "every
information for accesses" for GCC 12 and for GCC 11 restrict the information
to CONSTANT_CLASS_P trees.

Reply via email to