tonight I am annoyed by: a program that both gcc and clang compile at -O2 and neither compiles at -O0
-
-
@johnregehr UB b/c x was used before being initialized (unless static vars are special in that respect)? - View other replies
-
@cr1901 globals in C are zeroed -
@johnregehr@cr1901 just globals? I thought it was anything with static storage -
-
-
-
@johnregehr aren't statics zeroed? -
@mrkkrj they are zeroed -
@johnregehr than the mystery is solved -
@mrkkrj it's not a mystery, it's an annoyance
-
-
-
@johnregehr seems perfectly valid under the as-if rule: http://en.cppreference.com/w/cpp/language/as_if … -
@shafikyaghmour yes, valid but sometimes obnoxious
-
-
-
@johnregehr You mean that this code doesn't link with -O0?
-
-
-
@johnregehr undefined behaviour remains undefined? -
@Ferretzau nope, the program is perfectly well defined -
@johnregehr that prgm looked ill defined, assumed when constants assigned, which I thought was not specified, tho Im likely wrong.
-
-
@johnregehr a debug version walks into a bar(). A release version doesn't walk into a bar(). Joke's on you. -
-
@fugueish@johnregehr foo.c:(.text+0x1e): undefined reference to `bar'; at -O2 the call gets removed. a surprisingly subtle case! -
@stdlib@johnregehr Even with -Wall -Wextra, no warning about the always-false condition! sigh
-
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.
John Regehr
William D. Jones
marek krajewski
Shafik Yaghmour
Jens Gustedt
Ferretz
JF Bastien
Chris Palmer
austin seipp