------- Comment #5 from p dot vanhoof at oma dot be  2007-11-18 18:17 -------
I am not completely sure whether this is the same underlying problem, but I get
a bogus warning "array subscript is above array bounds" with the code snippet
below when compiled with gcc -c -O3 -Wall:

=================
#define N 10
extern long H[N];

long m()
{
        if( H[N-1] > 1 )
        {
                int i;
                for( i=0; i < N-1; ++i )
                        if( H[i+1] > 1 )
                                break;
                return H[i+1];
        }
        return 0;
}
=================

Note that the first if-statement guarantees that the break statement is always
executed and hence an out-of-bounds access is impossible. This is with gcc
4.3.0 20071116. This gcc version still reproduces the problem posted in comment
#4 as well.


-- 

p dot vanhoof at oma dot be changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p dot vanhoof at oma dot be


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

Reply via email to