http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47418
Summary: warning: array subscript is above array bounds at O2 with sin6_addr Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: dpmc...@gmail.com Host: x86_64-unknown-linux-gnu Target: x86_64-unknown-linux-gnu Build: x86_64-unknown-linux-gnu Created attachment 23083 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23083 Preprocessed test case Originally from http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=43491 Preprocessed stripped test case (<100 lines) attached. Only occurs on x86_64. At -O1 or -O0 this does not warn. It obviously also warns at -O3. $ pacman -Q glibc glibc 2.13-1 $ uname -a Linux galway 2.6.36-ARCH #1 SMP PREEMPT Sat Jan 8 14:15:27 CET 2011 x86_64 Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz GenuineIntel GNU/Linux $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /build/src/gcc-4.5.2/configure --prefix=/usr --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-gnu-unique-object --enable-lto --enable-plugin --enable-gold --with-plugin-ld=ld.gold --disable-multilib --disable-libstdcxx-pch --with-system-zlib --with-ppl --with-cloog --with-cloog-include=/usr/include/cloog-ppl --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info Thread model: posix gcc version 4.5.2 (GCC) $ gcc -O2 -Wall -c ftp-stripped.i ftp-stripped.i: In function ‘main’: ftp-stripped.i:86:30: warning: array subscript is above array bounds ftp-stripped.i:86:22: warning: array subscript is above array bounds ftp-stripped.i:86:14: warning: array subscript is above array bounds ftp-stripped.i:86:6: warning: array subscript is above array bounds ftp-stripped.i:85:28: warning: array subscript is above array bounds ftp-stripped.i:85:20: warning: array subscript is above array bounds ftp-stripped.i:85:13: warning: array subscript is above array bounds ftp-stripped.i:85:6: warning: array subscript is above array bounds On i686, no warnings at any optimization level occur. $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/lto-wrapper Target: i686-pc-linux-gnu Configured with: /build/src/gcc-4.5.2/configure --prefix=/usr --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-gnu-unique-object --enable-lto --enable-plugin --enable-gold --with-plugin-ld=ld.gold --disable-multilib --disable-libstdcxx-pch --with-system-zlib --with-ppl --with-cloog --with-cloog-include=/usr/include/cloog-ppl --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info Thread model: posix gcc version 4.5.2 (GCC)