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

            Bug ID: 86889
           Summary: s390x gcc build fails when configured with
                    --disable-checking
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iii at linux dot ibm.com
  Target Milestone: ---
              Host: s390x-linux-gnu
            Target: s390x-linux-gnu
             Build: s390x-linux-gnu

Seen on master (18d371d3):

build$ ../configure --disable-checking
build$ make -j$(getconf _NPROCESSORS_ONLN)

../../gcc/bitmap.c: In function ‘unsigned int
bitmap_last_set_bit(const_bitmap)’:
../../gcc/bitmap.c:841:26: error: array subscript -1 is below array bounds of
‘const BITMAP_WORD [2]’ {aka ‘const long unsigned int [2]’}
[-Werror=array-bounds]
       word = elt->bits[ix];

The code in question is:

 839   for (ix = BITMAP_ELEMENT_WORDS - 1; ix >= 0; ix--)
 840     {
 841       word = elt->bits[ix];
 842       if (word)
 843         goto found_bit;
 844     }

BITMAP_ELEMENT_WORDS on s390x is 2.
I narrowed this down to cunrolli pass, which unrolls this loop 3 times instead
of 2, so ix=[1, 0, -1] instead of just [1, 0].
And indeed, building this individual file with -fdisable-tree-cunrolli helps.

Reply via email to