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

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
The reduced test case below reproduces the spurious nature of the failure
outside the test harness:

$ (set -x; cat t.c && for i in 1 2 3; do gcc -O2 -S -Warray-bounds
-ftrack-macro-expansion=0 -m32 t.c ; done)
+ cat t.c
#define DIFF_MAX __PTRDIFF_MAX__
#define DIFF_MIN (-DIFF_MAX - 1)

void f (int);

void g (unsigned m, unsigned n)
{
  char a[m][n];

  f (a[0][DIFF_MAX]); 
}

+ for i in 1 2 3
+ gcc -O2 -S -Warray-bounds -ftrack-macro-expansion=0 -m32 t.c
t.c: In function ‘g’:
t.c:10:10: warning: array subscript 2147483647 is above array bounds of
‘char[<U5cf0> + 1]’ [-Warray-bounds]
   10 |   f (a[0][DIFF_MAX]);
      |      ~~~~^~~~~~~~~~
+ for i in 1 2 3
+ gcc -O2 -S -Warray-bounds -ftrack-macro-expansion=0 -m32 t.c
+ for i in 1 2 3
+ gcc -O2 -S -Warray-bounds -ftrack-macro-expansion=0 -m32 t.c
$

Reply via email to