#7997: undefined-behavior at libavcodec/proresenc_anatoliy.c
------------------------------------+-----------------------------------
             Reporter:  Suhwan      |                    Owner:
                 Type:  defect      |                   Status:  closed
             Priority:  normal      |                Component:  avcodec
              Version:  git-master  |               Resolution:  fixed
             Keywords:  ubsan       |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+-----------------------------------

Comment (by mkver):

 FFmpeg can choose to support only systems that support certain
 requirements; if your system doesn't fulfill them, it's your problem. Just
 saying.

 Furthermore, you probably don't understand the important difference
 between undefined and implementation-defined. The former allows a compiler
 to presume that situations that trigger undefined behaviour simply don't
 exist and optimize accordingly. In the situation of this patch, this means
 that the compiler is allowed to infer that val is >= 0, because it is
 left-shifted; and then this means that (val) >> 31 is 0 (presuming the
 typical 32bit ints), so that the second part of said macro can be
 eliminated. (This requires that both (val) in the macro are the same, i.e.
 that they are not the result of some function-call that would get
 evaluated twice (with possible side-effects and possibly different
 results); this requirement is fulfilled here.) Implementation-defined
 behaviour on the other hand does not confer said right on the compiler.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7997#comment:6>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to