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 tree-optimization/64277] New: [4.9/5.0 Regression] Incorrect warning "array subscript is above array bounds"


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64277

            Bug ID: 64277
           Summary: [4.9/5.0 Regression] Incorrect warning "array
                    subscript is above array bounds"
           Product: gcc
           Version: 4.9.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aivchenk at gmail dot com

>cat test.c
void foo(short a[], short m)                                                    
{                                                                               
  int i, j;                                                                     
  int f1[10];                                                                   
  short nc;                                                                     

  nc = m + 1;                                                                   
  if (nc > 3)                                                                   
    {                                                                           
      for (i = 0; i <= nc; i++)                                                 
        {                                                                       
          f1[i] = f1[i] + 1;                                                    
        }                                                                       
    }                                                                           

  for (i = 0, j = m; i < nc; i++, j--)                                          
    {                                                                           
      a[i] = f1[i];                                                             
      a[j] = i;                                                                 
    }                                                                           
  return;                                                                       
}                          
>gcc -O3 -mssse3 -Wall
/export/users/aivchenk/src/gcc_obj/test.c:21:16: warning: array subscript is
above array bounds [-Warray-bounds]
       a[i] = f1[i]; 
                ^

If compile with "-msse3" there is no warning.


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