[Bug c/34841] 'make check' of libsndfile-1.0.17 fails with gcc-4.2.2 -O2 optimization, OK with -O1 one

sergstesh at yahoo dot com gcc-bugzilla@gcc.gnu.org
Fri Jan 18 14:27:00 GMT 2008



------- Comment #15 from sergstesh at yahoo dot com  2008-01-18 14:08 -------
With CFLAGS='-O2 -Wstrict-overflow=5' still there is no warnings in
'make_check.log':

"

sergei@amdam2:/mnt/sda8/sergei/gcc4.2.x-O2_bug/gcc-4.2.2-O2/libsndfile-1.0.17>
grep -i warn make.log
sndfile.c:491: warning: the address of 'sf_error' will never be NULL
sndfile-play.c:292: warning: the address of ‘status’ will always
evaluate as ‘true’
sergei@amdam2:/mnt/sda8/sergei/gcc4.2.x-O2_bug/gcc-4.2.2-O2/libsndfile-1.0.17>
grep -i warn make_check.log
sergei@amdam2:/mnt/sda8/sergei/gcc4.2.x-O2_bug/gcc-4.2.2-O2/libsndfile-1.0.17>
grep -P '\-Wstrict-overflow=5' make.log | wc -l
341
sergei@amdam2:/mnt/sda8/sergei/gcc4.2.x-O2_bug/gcc-4.2.2-O2/libsndfile-1.0.17>  
",

so I think you are right there is a bug in gcc.

And there is apparently another bug.

If I do _not_ have "-Wstrict-overflow", I _do_ have these warnings during
compilation:

"
sergei@amdam2:/mnt/sda8/sergei/gcc4.2.x-O2_bug/gcc-4.2.2-O2/libsndfile-1.0.17>
grep "comparison between signed and unsigned"
../../gcc-4.2.2-O1/libsndfile-1.0.17/make.log
floating_point_test.c:338: warning: comparison between signed and unsigned
floating_point_test.c:388: warning: comparison between signed and unsigned
floating_point_test.c:438: warning: comparison between signed and unsigned
floating_point_test.c:488: warning: comparison between signed and unsigned
floating_point_test.c:538: warning: comparison between signed and unsigned
floating_point_test.c:588: warning: comparison between signed and unsigned
floating_point_test.c:638: warning: comparison between signed and unsigned
floating_point_test.c:688: warning: comparison between signed and unsigned
sergei@amdam2:/mnt/sda8/sergei/gcc4.2.x-O2_bug/gcc-4.2.2-O2/libsndfile-1.0.17>
".

If I have "-Wstrict-overflow", I do _not_ have the above warnings:

"
sergei@amdam2:/mnt/sda8/sergei/gcc4.2.x-O2_bug/gcc-4.2.2-O2/libsndfile-1.0.17>
grep "comparison between signed and unsigned" make.log
sergei@amdam2:/mnt/sda8/sergei/gcc4.2.x-O2_bug/gcc-4.2.2-O2/libsndfile-1.0.17> 
".

I believe I should have the warnings in both cases.

Folks, libsndfile is easy to compile - it has (kind of) no external 
dependencies, i.e. it depends only on basic libraries like libm, glibc, etc.,
so you can easily conduct such experiments yourselves - the the needed "beef",
including libsdnfile sources, is in the uploaded file.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34841



More information about the Gcc-bugs mailing list