[Bug c++/106502] Three calls to __attribute__((const)) function

2022-08-03 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106502 --- Comment #7 from Jonathan Wakely --- The way I found the bug might be, but the bug itself is nothing to do with that.

[Bug c++/106502] Three calls to __attribute__((const)) function

2022-08-03 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106502 Eric Gallager changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill

[Bug c++/106502] Three calls to __attribute__((const)) function

2022-08-02 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106502 --- Comment #5 from Jonathan Wakely --- I noticed this by adding a printf statement to the const function for temporary debugging purposes, which is obviously incorrect and not a problem for real code. It's not observable that it gets called mor

[Bug c++/106502] Three calls to __attribute__((const)) function

2022-08-02 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106502 --- Comment #4 from Richard Biener --- Once you enable optimization a single cat () call remains (as expected). The FE does 9931 if (TREE_SIDE_EFFECTS (argarray[0])) 9932argarray[0] = save_expr (argarray[0]); 9933

[Bug c++/106502] Three calls to __attribute__((const)) function

2022-08-01 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106502 --- Comment #3 from Jonathan Wakely --- It doesn't happen unless the name() function is virtual. Reduced: extern "C" int puts(const char*); struct Cat { virtual const char* name(); }; __attribute__((const)) Cat& cat(); int main() { puts

[Bug c++/106502] Three calls to __attribute__((const)) function

2022-08-01 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106502 Andrew Pinski changed: What|Removed |Added Keywords||missed-optimization --- Comment #2 from

[Bug c++/106502] Three calls to __attribute__((const)) function

2022-08-01 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106502 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever confirmed|0