[Bug c++/85747] suboptimal code without constexpr
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri May 11 09:43:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85747
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Well. Besides of the C++ frontend the compiler has no facility to fully
evaluate a part of a program but for cases like this it would rely on
inlining then unrolling and then constant propagation. All this work has
limits and heuristics and there are just cases where the heuristics need
to give up...
What's the reason for writing the code as you pasted it?
Note that sort isn't a const function since it modifies global memory.
More information about the Gcc-bugs
mailing list