[PATCH] C undefined behavior fix

Kai Henningsen kaih@khms.westfalen.de
Sat Jan 5 10:05:00 GMT 2002


jtv@xs4all.nl (jtv)  wrote on 03.01.02 in <20020103184414.D20936@xs4all.nl>:

> The arithmetic can't be helped--agreed.

Not agreed. It *can* be helped. It might not be pretty, but it is  
possible. And after eliminating that, *any* future gcc optimization can no  
longer break it (assuming it is otherwise correct, of course).

All of this mess is a consequence of lying to the compiler. The solution  
is rather obvious: don't do that.

MfG Kai



More information about the Gcc mailing list