On Thu, Jan 28, 2021 at 09:31:46AM +0100, Richard Biener via Gcc-patches wrote: > + if (TREE_CODE (bound) == PLUS_EXPR > + && integer_all_onesp (TREE_OPERAND (bound, 1))) > + { > + bound = TREE_OPERAND (bound, 0); > + if (TREE_CODE (bound) == NOP_EXPR) > + bound = TREE_OPERAND (bound, 0); > + } > > so it either does or does not strip a -1 but has no indication on > whether it did that? That looks fragile and broken.
Yeah. Plus again STRIP_NOPs in there should be used. But certainly it needs to remember whether there was + -1 or not and compensate for it. > The free-lang-data parts are OK. But is fld the right spot to do it? If it is only the FE that emits the warnings, shouldn't it be stripped already before gimplification so that it isn't actually corrupted? I mean in c_parse_final_cleanups or c_common_parse_file depending on if it is just C or C++ too? Plus, if the expressions in the attribute don't contain SAVE_EXPRs, why there isn't unshare_expr called on them (and if they do, I don't see how it would be guaranteed, can't one e.g. do int bar (void); void foo (int n, int a[n + 1][bar () + 2], int b[sizeof (a[0]) + 32]) { } ?) the unsharing variant I've pasted into the PR. Jakub