public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/39757]  New: inconsistency in array bounds checking with -O3
@ 2009-04-14  2:58 ptrktn at gmail dot com
  2009-04-14  3:00 ` [Bug middle-end/39757] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: ptrktn at gmail dot com @ 2009-04-14  2:58 UTC (permalink / raw)
  To: gcc-bugs

[-- 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/39757] inconsistency in array bounds checking with -O3
  2009-04-14  2:58 [Bug c/39757] New: inconsistency in array bounds checking with -O3 ptrktn at gmail dot com
@ 2009-04-14  3:00 ` pinskia at gcc dot gnu dot org
  2009-04-20 22:56 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-14  3:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-04-14 03:00 -------
-O3 has extra inlining.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |middle-end


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/39757] inconsistency in array bounds checking with -O3
  2009-04-14  2:58 [Bug c/39757] New: inconsistency in array bounds checking with -O3 ptrktn at gmail dot com
  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
  3 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-04-20 22:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2009-04-20 22:56 -------
(In reply to comment #1)
> -O3 has extra inlining.
> 

 ~/trunk/146344/build/gcc/cc1 -DNO_LCMS -Wall -Werror -O3 dcraw.i
-fno-inline-functions -fno-inline

Still the same warnings. So, it seems to be some other reason.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/39757] inconsistency in array bounds checking with -O3
  2009-04-14  2:58 [Bug c/39757] New: inconsistency in array bounds checking with -O3 ptrktn at gmail dot com
  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
  3 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-08-05 10:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2009-08-05 10:01 -------
By the way, we would prefer a preprocessed testcase, as minimal as possible. 
See http://gcc.gnu.org/bugs.html#report

Thanks.


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/39757] inconsistency in array bounds checking with -O3
  2009-04-14  2:58 [Bug c/39757] New: inconsistency in array bounds checking with -O3 ptrktn at gmail dot com
                   ` (2 preceding siblings ...)
  2009-08-05 10:01 ` manu at gcc dot gnu dot org
@ 2009-08-13  1:15 ` petteri dot kettunen at nokia dot com
  3 siblings, 0 replies; 6+ messages in thread
From: petteri dot kettunen at nokia dot com @ 2009-08-13  1:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from petteri dot kettunen at nokia dot com  2009-08-13 01:15 -------
This is a bit odd but the bug was not reproducible when I tried to compile a
minimal example in a file containing that function only. I shall investigate a
bit more.


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/39757] inconsistency in array bounds checking with -O3
       [not found] <bug-39757-4@http.gcc.gnu.org/bugzilla/>
@ 2012-02-02 20:41 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-02-02 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-02-02 20:41:15 UTC ---
We have:
  short last[3] = { 16,16,16 }, mul[3], buf[3][3][386];
  for (i=0; i < sizeof(buf)/sizeof(short); i++)
    buf[0][0][i] = 2048;

Obviously this where one of the warning happens.

Likewise for:
  float cfilt=0, ddft[3][3][2], ppm[3][3][3];


>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.

That warning is correct.  Now for the other part, this warning really depends
on optimization and is not always 100% of producing all the warnings it could.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-02-02 20:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-14  2:58 [Bug c/39757] New: inconsistency in array bounds checking with -O3 ptrktn at gmail dot com
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
     [not found] <bug-39757-4@http.gcc.gnu.org/bugzilla/>
2012-02-02 20:41 ` pinskia at gcc dot gnu.org

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).