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 middle-end/37861] Bogus array bounds warning



------- Comment #3 from jamborm at gcc dot gnu dot org  2008-10-31 17:52 -------
The test-case  in the bug description  leads to bogus  warnings in the
second  run of the  VRP pass.   Yesterday me  and Richi  discussed the
possibility of simply  not-giving out any warnings in  the second runs
(as opposed  to the first which  would still generate  the warnings it
does).

However, I have managed to modify the test case so that bogus warnings
are spitted  out in  the first  run and so  this workaround  would not
really solve the problem:

extern int printf (__const char *__restrict __format, ...);

static int f3(int v)
{
  int i,j = 0;
  for (i = 0; i <= v; i++)
    j++;
  return j;
}

static int f2(char formatstr[10][100]) {
  printf( "%d %s\n", 0, formatstr[f3(0)] );
  printf( "%d %s\n", 1, formatstr[f3(1)] );
  printf( "%d %s\n", 2, formatstr[f3(2)] );
  printf( "%d %s\n", 3, formatstr[f3(3)] );
  return 3;
}

static   char formatstr[10][100];
int main( void ) {
  int anz;
  anz = f2(formatstr);
  printf( "   %d\n",anz);
  return 0;
}


-- 

jamborm at gcc dot gnu dot org changed:

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


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


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