Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
kccqzy
9y ago
0 comments
Save
Share
With -O2 gcc actually compiles the program to
xorl %eax, %eax ret
That is, it optimized away everything.
0 comments
1 comments · 1 top-level
top
newest
oldest
acqq
9y ago
Yes, that's the correct optimization. That code obviously can't perform printf("error\n") to manifest the bug, and obviously both additions were made compile-time producing the results that are equal.
j
/
k
navigate · click thread line to collapse