This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/39757] New: inconsistency in array bounds checking with -O3


gcc version:

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1.1'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-targets=all --enable-cld
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu
Thread model: posix
gcc version 4.3.2 (Debian 4.3.2-1.1) 

system type: Linux debian 2.6.26-1-686 #1 SMP Fri Mar 13 18:08:45 UTC 2009 i686
GNU/Linux

command line:

gcc -DNO_LCMS -Wall -Werror -O3 -c -o dcraw.o dcraw.c

source files:

curl -O 'http://www.cybercom.net/~dcoffin/dcraw/dcraw.c'

description of the expected behavior:

Compiles without errors.

description of actual behavior:

cc1: warnings being treated as errors
dcraw.c: In function ?adobe_coeff?:
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c: In function ?parse_phase_one?:
dcraw.c:5751: error: array subscript is above array bounds
dcraw.c:5751: error: array subscript is above array bounds
dcraw.c:5751: error: array subscript is above array bounds
dcraw.c:5751: error: array subscript is above array bounds
dcraw.c:5751: error: array subscript is above array bounds
dcraw.c:5751: error: array subscript is above array bounds

The inconsistency hcc1: warnings being treated as errors
dcraw.c: In function ?adobe_coeff?:
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c:6493: error: array subscript is above array bounds
dcraw.c: In function ?parse_phase_one?:
dcraw.c:5751: error: array subscript is above array bounds
dcraw.c:5751: error: array subscript is above array bounds
dcraw.c:5751: error: array subscript is above array bounds
dcraw.c:5751: error: array subscript is above array bounds
dcraw.c:5751: error: array subscript is above array bounds
dcraw.c:5751: error: array subscript is above array bounds


For one, the compiler considers it an issues that array cam_xyz[4][3] is
accessed as cam_xyz[0][j], 0 <= j < 12. This issue is found with -O3 but not
with -O2.

The inconsistency, which I see is a bug, is that romm_camm[3][3] which is
accessed as romm_cam[0][i], i <= j < 9, does not raise an error even after the
above two cases are fixed.


-- 
           Summary: inconsistency in array bounds checking with -O3
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ptrktn at gmail dot com
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i686-linux-gnu
GCC target triplet: i486-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]