[FFmpeg-devel] [RFC] Sechole in gcc 3.3+ and 4.*

Michael Niedermayer michaelni
Sat Apr 12 16:57:10 CEST 2008


On Sat, Apr 12, 2008 at 09:57:55AM -0400, Dave Dodge wrote:
[...]
> > Also undefined overflow is nowhere mentioned except that example, it is
> > NOT amongth the list of undefined things.
> 
> There's a catch-all in section 4:
> 
>   Undefined behavior is otherwise indicated in this International
>   Standard by the words "undefined behavior" or by the omission of any
>                                              ^^^^^^^^^^^^^^^^^^^^^^^^^
>   explicit definition of behavior.
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Also, they clearly intended to allow signed overflow to generate a
> trap on some architectures, and there's very little in the way of
> constraints on what traps might do.  It was probably easier to leave
> it undefined than try to think up all the ways an architecture might
> reasonably react -- aborting execution, wrapping the value, sending a
> signal, capping the value at INT_MAX, etc.

Thats all fine, what bothers me is that compilers take this litterally
and create undefined behavior which is unrelated to the behavior the
underlaying machine instructions have. Even more so that all modern
computers have identically behaving instructions for +-. Iam
not aware of anything that lacks "wrap around" instructions.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080412/97793358/attachment.pgp>



More information about the ffmpeg-devel mailing list