Bug#431889: classpath: FTBFS with gcc-4.2: The address of pinfo will always evaluate as true

Michael Koch konqueror at gmx.de
Fri Jul 6 06:29:11 UTC 2007


On Thu, Jul 05, 2007 at 02:49:18PM -0400, Daniel Schepler wrote:
> /bin/sh ../../../libtool --tag=CC   --mode=compile i486-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../../../include  -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib `pkg-config  --cflags-only-I alsa`  -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -Werror `pkg-config --cflags-only-other alsa` -g -O2 -c -o gnu_javax_sound_midi_alsa_AlsaPortDevice.lo gnu_javax_sound_midi_alsa_AlsaPortDevice.c
>  i486-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -I/usr/include/alsa -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -Werror -g -O2 -c gnu_javax_sound_midi_alsa_AlsaPortDevice.c  -fPIC -DPIC -o .libs/gnu_javax_sound_midi_alsa_AlsaPortDevice.o
> cc1: warnings being treated as errors
> gnu_javax_sound_midi_alsa_AlsaPortDevice.c: In function 'Java_gnu_javax_sound_midi_alsa_AlsaPortDevice_run_1receiver_1thread_1':
> gnu_javax_sound_midi_alsa_AlsaPortDevice.c:57: warning: the address of 'pinfo' will always evaluate as 'true'
> gnu_javax_sound_midi_alsa_AlsaPortDevice.c:58: warning: the address of 'sinfo' will always evaluate as 'true'
> gnu_javax_sound_midi_alsa_AlsaPortDevice.c:59: warning: the address of 'subs' will always evaluate as 'true'
> make[4]: *** [gnu_javax_sound_midi_alsa_AlsaPortDevice.lo] Error 1

The problem is that pinfo, sinfo and subs are all local variables. The
codes uses the & operator on them which is always a valid value and
never NULL. &foo is used as argument to a macro which does assert(&foo);
The compiler recognices that this is always true. This macro is in seq.h
(from libasound2-dev) guards against NULL pointers given to it which
makes sense.

To disable that warning its possible to use -Wno-address but this is
unknown in earlier versions of GCC. I will add it when GCC 4.2 becomes
default in unstable.


Cheers,
Michael
-- 
 .''`.  | Michael Koch <konqueror at gmx.de>
: :' :  | Free Java Developer <http://www.classpath.org>
`. `'   |
  `-    | 1024D/BAC5 4B28 D436 95E6 F2E0 BD11 5923 A008 2763 483B




More information about the pkg-java-maintainers mailing list