[Bug analyzer/117262] [15 regression] Analyzer doesn't handle RAW_DATA_CST properly
dmalcolm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 11 22:28:58 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117262
--- Comment #7 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
tree.def has:
/* Used to represent the brace-enclosed initializers for a structure or an
array. It contains a sequence of component values made out of a VEC of
constructor_elt.
For RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE:
The field INDEX of each constructor_elt is a FIELD_DECL.
For ARRAY_TYPE:
The field INDEX of each constructor_elt is the corresponding index.
If the index is a RANGE_EXPR, it is a short-hand for many nodes,
one for each index in the range. (If the corresponding field VALUE
has side-effects, they are evaluated once for each element. Wrap the
value in a SAVE_EXPR if you want to evaluate side effects only once.)
Components that aren't present are cleared as per the C semantics,
unless the CONSTRUCTOR_NO_CLEARING flag is set, in which case their
value becomes undefined. */
DEFTREECODE (CONSTRUCTOR, "constructor", tcc_exceptional, 0)
which suggests to me that if we're initializing more than one index, it should
be a RANGE_EXPR, not an INTEGER_CST. Or would a RANGE_EXPR mean initialize
each element in the range with a copy of the value, and thus they would all get
the first element of the raw_data_cst?
More information about the Gcc-bugs
mailing list