[Bug c/14750] type-punned pointer causes bad code

Joseph S. Myers jsm@polyomino.org.uk
Sat Mar 27 19:52:00 GMT 2004


On Sat, 27 Mar 2004, lindsayd at cisco dot com wrote:

> It the compiler is about to generate incorrect code, then it shouldn't be a
> warning, it should be an error.

No, the function might never be executed.  DR#109 is clear: "A conforming
implementation must not fail to translate a strictly conforming program
simply because _some_ possible execution of that program would result in
undefined behavior.".

http://std.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_109.html

-- 
Joseph S. Myers
jsm@polyomino.org.uk



More information about the Gcc-bugs mailing list