Bug#789250: bs1770gain: Fail to build on archs with strict alignment requirements

Peter Belkner pbelkner at snafu.de
Wed Jun 24 05:23:51 UTC 2015


> The first build of bs1770gain on the autobuilders showed an error on at
> least the mipsel architecture, that look like this:
>
> ffsox_frame_convert.c: In function 'convert_s16i_s8i':
> ffsox_frame_convert.c:143:6: error: cast increases required alignment of target type [-Werror=cast-align]
>     rp=(R *)p->fr->frame->data[0]; \
>        ^
> ffsox_frame_convert.c:157:1: note: in expansion of macro 'CONVERT_II'
>   CONVERT_II(s16,s8,int16_t,int8_t,CONVERT_INT_INT_II)
>   ^
> ffsox_frame_convert.c: In function 'convert_s32i_s8i':
> ffsox_frame_convert.c:143:6: error: cast increases required alignment of target type [-Werror=cast-align]
>     rp=(R *)p->fr->frame->data[0]; \
>        ^
> ffsox_frame_convert.c:158:1: note: in expansion of macro 'CONVERT_II'
>
> I'm not quite sure how to fix it.

"p->fr->frame->data[0]" is a generic pointer defined in the "AVFrame" 
structure from the FFmpeg API. It is of type "uint8_t" (cf. e.g. top of 
https://www.ffmpeg.org/doxygen/2.3/structAVFrame.html) but may point to 
data of an arbitrary type. The code triggering the error cast the 
(generic) pointer back to it's real type.

Those kinds of interfaces utilizing generic pointers which has to be 
cast back their real type are a common C technique and not an error.

To fix the error drop "-Wcast-align" from "CFLAGS" in the respective 
"Makefile.am".

The fix is available with version 0.4.4 available from 
http://sourceforge.net/projects/bs1770gain/files/bs1770gain/0.4.4/.



More information about the pkg-multimedia-maintainers mailing list