At the LLVM Bay Area meetup this question came up
“What does -O0 mean to you?”
A. No transformations, straight translation
B. Transformations that don’t inhibit debuggability
C. B + no undefined behavior
D. Something else, explain
#Cplusplus #Programming #CppPolls
-
-
Replying to @shafikyaghmour
D. Spew gratuitous stack traffic all over everything.
2 replies 0 retweets 9 likes -
Replying to @stephentyrone
Which is how I was taught it should work back in the late 80s and early 90s. So that is encompassed in no transformations
1 reply 0 retweets 0 likes -
Replying to @shafikyaghmour
Confession: I still don't really understand why this happens at O0. More precisely, I understand *how* it happens, but I don't understand why we're OK with it.
3 replies 0 retweets 1 like -
Replying to @stephentyrone @shafikyaghmour
Optimizer gotta justify its existence! Also something about debugging being trivially easier because stack slots
1 reply 0 retweets 1 like -
Replying to @jfbastien @shafikyaghmour
Personally I'd prefer readable output at -O0, but meh.
1 reply 0 retweets 1 like -
I don’t think GDB knows how to deal with variables living registers, like, at all? Doesn’t it print them as “<optimized out>”?
2 replies 0 retweets 1 like -
Yeah, but that’s GDB’s fault.
2 replies 0 retweets 0 likes -
Well, it’s a chicken and egg problem… -O0 can’t improve without breaking GDB, while GDB has no incentive to improve until -O0 improves…
1 reply 0 retweets 0 likes -
What’s an GDB?
2 replies 0 retweets 2 likes
God, the Devil and Bob apparentlypic.twitter.com/yR2EBYfOJQ
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.