Gentoo QA warnings on libgtop-2.28.2: netload.c: dereferencing type-punned pointer will break strict-aliasing rules
Submitted by Dan Wallis
Link to original bug (#641592)
Description
When installing the gnome-base/libgtop-2.28.2 package on my Gentoo system, I received the following notification:
- QA Notice: Package has poor programming practices which may compile
-
fine but exhibit random runtime failures.
- netload.c:156: warning: dereferencing type-punned pointer will break strict-aliasing rules
- netload.c:159: warning: dereferencing type-punned pointer will break strict-aliasing rules
- netload.c:164: warning: dereferencing type-punned pointer will break strict-aliasing rules
- netload.c:166: warning: dereferencing type-punned pointer will break strict-aliasing rules
- netload.c:170: warning: dereferencing type-punned pointer will break strict-aliasing rules
Looking at the build output, here are the warnings in context:
/bin/sh ../../libtool --tag=CC --mode=compile i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../.. -I../../sysdeps/linux -I../../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-Winline -Wall -std=gnu89 -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -O2 -march=i686 -pipe -MT sysinfo.lo
-MD -MP -MF .deps/sysinfo.Tpo -c -o sysinfo.lo sysinfo.c
libtool: compile: i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../.. -I../../sysdeps/linux -I../../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Winline -Wall -std=gnu89 -Wchar-su
bscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -O2 -march=i686 -pipe -MT sysinfo.lo -MD -MP -MF .deps/sysinfo.Tpo -c sysinfo.c -fPIC -DPIC -o
.libs/sysinfo.o
mv -f .deps/sysinfo.Tpo .deps/sysinfo.Plo
/bin/sh ../../libtool --tag=CC --mode=compile i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../.. -I../../sysdeps/linux -I../../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Winline -Wall -std=gnu89 -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -O2 -march=i686 -pipe -MT netload.lo -MD -MP -MF .deps/netload.Tpo -c -o netload.lo netload.c
libtool: compile: i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../.. -I../../sysdeps/linux -I../../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Winline -Wall -std=gnu89 -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -O2 -march=i686 -pipe -MT netload.lo -MD -MP -MF .deps/netload.Tpo -c netload.c -fPIC -DPIC -o .libs/netload.o
netload.c: In function ‘get_ipv6’:
netload.c:156: warning: dereferencing type-punned pointer will break strict-aliasing rules
netload.c:159: warning: dereferencing type-punned pointer will break strict-aliasing rules
netload.c:164: warning: dereferencing type-punned pointer will break strict-aliasing rules
netload.c:166: warning: dereferencing type-punned pointer will break strict-aliasing rules
netload.c:170: warning: dereferencing type-punned pointer will break strict-aliasing rules
netload.c: In function ‘linux_2_0_stats’:
netload.c:275: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
netload.c: In function ‘linux_2_4_stats’:
netload.c:356: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
netload.c:357: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
mv -f .deps/netload.Tpo .deps/netload.Plo
/bin/sh ../../libtool --tag=CC --mode=compile i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../.. -I../../sysdeps/linux -I../../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Winline -Wall -std=gnu89 -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -O2 -march=i686 -pipe -MT ppp.lo -MD -MP -MF .deps/ppp.Tpo -c -o ppp.lo ppp.c
libtool: compile: i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../.. -I../../sysdeps/linux -I../../include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Winline -Wall -std=gnu89 -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -O2 -march=i686 -pipe -MT ppp.lo -MD -MP -MF .deps/ppp.Tpo -c ppp.c -fPIC -DPIC -o .libs/ppp.o
mv -f .deps/ppp.Tpo .deps/ppp.Plo
There are also a number of other GCC warnings, but those are less concerning, and don't trigger QA notices on my system.