[FFmpeg-trac] #9986(avutil:new): Compilation error [-Wincompatible-pointer-types] on AOSP for x86 (32bits)
FFmpeg
trac at avcodec.org
Sun Oct 23 14:15:13 EEST 2022
#9986: Compilation error [-Wincompatible-pointer-types] on AOSP for x86 (32bits)
-------------------------------------+----------------------------------
Reporter: goffioul | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: avutil
Version: unspecified | Resolution:
Keywords: vaapi | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+----------------------------------
Comment (by goffioul):
Please learn that the extra compilation flags were just a mean to an end,
to reach a similar situation as when building within AOSP. The issue was
detected with Android, but it's actually a generic incompatible pointer
assignment problem, so I provided a simpler way for you to trigger the
compilation error.
The variable `buffer_handle` is declared with type `unsigned long`. Its
address is then assigned to a `uintptr_t *` field member. This trigger the
Wincompatible-pointer-types warning in both gcc and clang, and a
compilation error when using Werror.
To answer your question about using --disable-vaapi, obviously the
original compilation error will disappear, as the corresponding file is
not compiled in. It's a no-brainer. However, compilation still fails, but
only with gcc, with this error:
{{{
src/libavutil/timecode.c: In function ‘av_timecode_make_string’:
src/libavutil/timecode.c:123:60: error: ‘%0*d’ directive output may be
truncated writing between 1 and 10 bytes into a region of size between 2
and 14 [-Werror=format-truncation=]
123 | snprintf(buf, AV_TIMECODE_STR_SIZE, "%s%02d:%02d:%02d%c%0*d",
| ^~~~
src/libavutil/timecode.c:123:41: note: directive argument in the range [0,
2147483647]
123 | snprintf(buf, AV_TIMECODE_STR_SIZE, "%s%02d:%02d:%02d%c%0*d",
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/libavutil/timecode.c:123:5: note: ‘snprintf’ output between 11 and 32
bytes into a destination of size 23
123 | snprintf(buf, AV_TIMECODE_STR_SIZE, "%s%02d:%02d:%02d%c%0*d",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
124 | neg ? "-" : "",
| ~~~~~~~~~~~~~~~
125 | hh, mm, ss, drop ? ';' : ':', ff_len, ff);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CC libavutil/tx.o
cc1: some warnings being treated as errors
}}}
This can be worked around by using `--extra-cflags=-Wno-format-
truncation`, in which case ffmpeg compilation succeeds. This is however
specific to gcc, as to my knowledge clang does not have Wformat-truncation
warning. Hence, this specific error does not pop up with AOSP.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9986#comment:4>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list