Volatiles are often miscompiled
Posted: Sun Apr 20, 2014 7:00 pm
Thought you guys might be interested in this: http://www.cs.utah.edu/~regehr/papers/e ... eprint.pdf.
The Place to Start for Operating System Developers
http://forum.osdev.org./
Would you care to elaborate on how exactly it's not up to date?XenOS wrote:A paper from 2008 is not quite up to date with current compilers and standards, but still interesting to read and certainly good to know. One should keep this in mind when searching for bugs with volatile variables, and double check the compiler output in that case.
Check the versions of the compilers used in the paper vs. current versions of the same compilers.alexfru wrote:Would you care to elaborate on how exactly it's not up to date?XenOS wrote:...
Volatile wasn't exactly new in '08. It was in the original K&R C released in 1978. If the bugs hadn't been fixed in the 30 years previous, they likely weren't fixed in the 6 years following. That is, unless this paper brought the bugs to compiler devs' attention. But even then, I would guess the reason they lasted 30 years probably had something to do with the difficulty in fixing them, which would increase the likelihood they still aren't fixed.XenOS wrote:A paper from 2008 is not quite up to date with current compilers and standards, but still interesting to read and certainly good to know. One should keep this in mind when searching for bugs with volatile variables, and double check the compiler output in that case.
Compiler versions aren't of much relevance, they aren't definitive. The main question is about what has changed in the language standard(s) and which version of the standard which compiler supports. Since 2008 there's been only one standard update (C++03 -> C++11 and C99 -> C11). It would be nice to hear not just that the paper is somewhat outdated, but how, it shouldn't be a huge difference (a paragraph perhaps, maybe a little more?), right?tjmonk15 wrote:Check the versions of the compilers used in the paper vs. current versions of the same compilers.alexfru wrote:Would you care to elaborate on how exactly it's not up to date?XenOS wrote:...
Then you didn't properly read what the paper said itself:Compiler versions aren't of much relevance
because, as of this writing, no release incorporates fixes to all of the bugs we reported. (...) Our experiment is ongoing and we expect that within the
foreseeable future, LLVM - GCC will be effectively free of volatile and functional bugs for the programs emitted by randprog.
Oh but they are. Upgrading is a cost/benefit question for many non-hobby projects.alexfru wrote:Compiler versions aren't of much relevance, they aren't definitive.
Standards are fairly meaningless unless they're adopted. I use ANSI C so C99 and C11 have absolutely no meaning to me and I'm not alone.alexfru wrote: The main question is about what has changed in the language standard(s) and which version of the standard which compiler supports. Since 2008 there's been only one standard update (C++03 -> C++11 and C99 -> C11).
Exactly. Those compiler versions are really outdated. And even if these bugs existed for 30 years, they were discovered, pointed out in this article and reported:tjmonk15 wrote:Check the versions of the compilers used in the paper vs. current versions of the same compilers.alexfru wrote:Would you care to elaborate on how exactly it's not up to date?
Combuster wrote:Then you didn't properly read what the paper said itself:Compiler versions aren't of much relevancebecause, as of this writing, no release incorporates fixes to all of the bugs we reported. (...) Our experiment is ongoing and we expect that within the
foreseeable future, LLVM - GCC will be effectively free of volatile and functional bugs for the programs emitted by randprog.
Wow.bwat wrote:Standards are fairly meaningless unless they're adopted. I use ANSI C so C99 and C11 have absolutely no meaning to me and I'm not alone.
It has nothing to do with geography or standard bodies (e.g. ANSI vs. ISO); and everything to do with history. Basically; bwat prefers "old" and doesn't like "new" (and doesn't care about which standard body was responsible for "old").Candy wrote:ANSI is just the American standards institute. The International Standards Organisation (ISO) produces documents called ISO9899 and ISO14882, which describe C and C++ in their international variants which have been the norm since 1989. That's where C99 and C11 come from - C99 is short for ISO9899:1999 and C11 is short for ISO9899:2011.bwat wrote:Standards are fairly meaningless unless they're adopted. I use ANSI C so C99 and C11 have absolutely no meaning to me and I'm not alone.
That's a pretty ignorant stance to have. Try to at least think outside of the US-centered box that you currently live in.