public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ptrktn at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/39757]  New: inconsistency in array bounds checking with -O3
Date: Tue, 14 Apr 2009 02:58:00 -0000	[thread overview]
Message-ID: <bug-39757-17568@http.gcc.gnu.org/bugzilla/> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3885 bytes --]

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


             reply	other threads:[~2009-04-14  2:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-14  2:58 ptrktn at gmail dot com [this message]
2009-04-14  3:00 ` [Bug middle-end/39757] " pinskia at gcc dot gnu dot org
2009-04-20 22:56 ` manu at gcc dot gnu dot org
2009-08-05 10:01 ` manu at gcc dot gnu dot org
2009-08-13  1:15 ` petteri dot kettunen at nokia dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-39757-17568@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).