Repository navigation
Replies: 1 comment
|
In my opinion, whether or not |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
EDG over GCC defines macros like
__GNUC__, so it might be nice to do__OPTIMIZE__as well.Though if you choose to do so, you might also want to think if
#pragma GCC optimizeshould be supported,because it changes
__OPTIMIZE__with GCC. https://godbolt.org/z/YTao871bYDunno how that support would look like, is
optimize "O0" -> undefine, otherwise define as 1sufficient?Example I experienced
I ran into a hilarious composition of edge-casey behaviour recently related to this.
I tried compiling some code that uses fmt library: https://godbolt.org/z/8rxTzT5ro
Because of no
__OPTIMIZE__, fmt does#pragma GCC optimize "Og"Removing fmt from the equation: https://godbolt.org/z/WPrTzY7ed
It turns out this is related to
-fipa-icf-functionsspecifically, implied by-O2We can simplify out the pragma with that knowledge: https://godbolt.org/z/YjcfzvaKb
This really doesn't have anything to do with reflection itself, but a snippet within triggers the bug.
Simplifying until my fingers hurt: https://godbolt.org/z/vEfovv8ax
(IIRC
aisstd::addressof,risstd::forward,cisstd::construct_at,Sisstd::string,Eisstd::meta::exception, andfisstd::meta::access_context::via)Taking a look at the C EDG emitted, and reducing: https://godbolt.org/z/Gbqvx14Eo
Making it a bit more readable: https://godbolt.org/z/Pcf7MhseP
Slight further reduction: https://godbolt.org/z/bzb8d7j4e
This is a bug with GCC since 12, report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127703
Summary
__OPTIMIZE____EDG__, so thinks it is just GCC, and because of no__OPTIMIZE__does#pragma GCC optimize "Og"-O2, we are in effectively-Og -fipa-icf-functionscompilationalways_inlinein-Og -fipa-icf-functionsspecificallyAll reactions