Posted Jul 17, 2009 16:15 UTC (Fri) by khim (subscriber, #9252)
[Link]
It would have been better for gcc to print a 'test for NULL after
use' warning than for it to silently optimize-away the code.
If you think GCC is bad then think again. RVCT will happily optimize away
things like "if (!this) { ... }" - because standard gurantees
that this is never NULL!
It's not the worst offender
Posted Jul 17, 2009 22:32 UTC (Fri) by nix (subscriber, #2304)
[Link]
A while back Robert Dewar described an extreme example of something
similar here
(though this involved uninitialized variables instead).
Linux 2.6.30 exploit posted
Posted Jul 18, 2009 1:38 UTC (Sat) by kjp (subscriber, #39639)
[Link]
Agreed. I can't believe -Wall wouldn't turn something like that on.
Linux 2.6.30 exploit posted
Posted Jul 20, 2009 8:55 UTC (Mon) by tialaramex (subscriber, #21167)
[Link]
One of Raymond Chen's rules applies: Features do not exist by default.
If you (or the kernel developer responsible for this goof, or anyone else) want GCC to emit a diagnostic for this scenario then they need to write code to detect the scenario (which may be very tricky depending on how spread through GCC the different aspects of it are) and write an informative warning message.
If nobody has yet done this, there is no warning included in -Wall.
(Insert generic complaint about how when I was a lad we had to write our own compilers, and it were up hill both ways)
Linux 2.6.30 exploit posted
Posted Jul 20, 2009 10:58 UTC (Mon) by muntyan (subscriber, #58894)
[Link]
> Features do not exist by default.
Or they get removed. GCC folks break warnings by "optimizations".
Linux 2.6.30 exploit posted
Posted Jul 20, 2009 19:17 UTC (Mon) by stevenb (guest, #11536)
[Link]
Ah, so fact-based, the parent. Examples?
Linux 2.6.30 exploit posted
Posted Jul 21, 2009 5:14 UTC (Tue) by muntyan (subscriber, #58894)
[Link]
Posted Jul 21, 2009 9:43 UTC (Tue) by muntyan (subscriber, #58894)
[Link]
Did *you* read the bug report? Some quotes: "this is a regression", "It has never worked on the tree-ssa branch", "The 4.x compilers does not warn when using unset variables. The 3.x compilers did warn on this: ...". Gcc-3 produces better warnings, while gcc-4 gives you code which crashes 2% faster.
Linux 2.6.30 exploit posted
Posted Jul 30, 2009 13:59 UTC (Thu) by lysse (guest, #3190)
[Link]
Apparently you both read the bug report and came away with different meanings of it. Now stop waving your willies at each other and have a nice cup of tea.