Bug#362422: FTBFS with GCC 4.2: the address of 'hwparams' will
always evaluate as 'true'
Samuel Mimram
smimram at debian.org
Mon May 15 18:20:46 UTC 2006
Hi,
On Thu, Apr 13, 2006 at 01:38:11PM +0200, Martin Michlmayr wrote:
> Package: linphone
> Version: 1.3.3-1
>
> Your package fails to build with GCC 4.2. Version 4.2 has not been
> released yet but I'm building with a snapshot in order to find errors
> and give people an advance warning. The bug below is in your package
> and not because I'm using a snapshot of the compiler so please take a
> look at it. You can reproduce this with the gcc-snapshot package.
>
>
> > Automatic build of linphone_1.3.3-1 on em64t by sbuild/amd64 1.112
> ...
> > if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../oRTP/include -I../gsmlib `cat ../oRTP/ortp.defs` -Wall -Wp,-D_FORTIFY_SOURCE=2 -Werror -Wall -g -O2 -fno-strict-aliasing -MT alsa.lo -MD -MP -MF ".deps/alsa.Tpo" -c -o alsa.lo alsa.c; \
> > then mv -f ".deps/alsa.Tpo" ".deps/alsa.Plo"; else rm -f ".deps/alsa.Tpo"; exit 1; fi
> > gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../oRTP/include -I../gsmlib -DORTP_INET6 -Wall -Wp,-D_FORTIFY_SOURCE=2 -Werror -Wall -g -O2 -fno-strict-aliasing -MT alsa.lo -MD -MP -MF .deps/alsa.Tpo -c alsa.c -fPIC -DPIC -o .libs/alsa.o
> > cc1: warnings being treated as errors
> > alsa.c: In function 'alsa_set_params':
> > alsa.c:55: warning: the address of 'hwparams', will always evaluate as 'true'
> > alsa.c:128: warning: the address of 'swparams', will always evaluate as 'true'
> > make[5]: *** [alsa.lo] Error 1
The relevant part of alsa.c in linphone is:
snd_pcm_hw_params_t *hwparams=NULL;
snd_pcm_hw_params_alloca(&hwparams);
The function snd_pcm_hw_params_alloca is defined by alsa
(libasound2-dev) in pcm.h by:
#define snd_pcm_hw_params_alloca(ptr) do { assert(ptr); *ptr =
(snd_pcm_hw_params_t *) alloca(snd_pcm_hw_params_sizeof()); memset(*ptr,
0, snd_pcm_hw_params_sizeof()); } while (0)
So, I guess the warning comes from the assert(ptr) where ptr will always
be != 0. In my opinion, an assert(true) should not raise a warning...
It seems to be confirmed by the following test:
$ cat test.c
#include <alsa/asoundlib.h>
int main()
{
snd_pcm_hw_params_t *hwparams=NULL;
assert(&hwparams);
return 0;
}
$ gcc -Werror -Wall test.c -o test
cc1: warnings being treated as errors
test.c: In function 'main':
test.c:6: warning: the address of 'hwparams', will always evaluate as 'true'
Should I reassign this to gcc, or is it a bug in linphone (should I remove the -Werror)?
Thanks.
Regards,
Samuel.
More information about the Pkg-voip-maintainers
mailing list