[Bug c++/106502] Three calls to __attribute__((const)) function
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Aug 2 10:04:57 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106502
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Once you enable optimization a single cat () call remains (as expected). The
FE does
9931 if (TREE_SIDE_EFFECTS (argarray[0]))
9932 argarray[0] = save_expr (argarray[0]);
9933 t = build_pointer_type (TREE_TYPE (fn));
9934 fn = build_vfn_ref (argarray[0], DECL_VINDEX (fn));
but argarray[0] doesn't have TREE_SIDE_EFFECTS set, it even has TREE_READONLY
set on the CONVERT_EXPR wrapping the call. Note that save_expr would do
nothing on this tree as well (because TREE_READONLY and !TREE_SIDE_EFFECTS).
More information about the Gcc-bugs
mailing list