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

            Bug ID: 109215
           Summary: warning: array subscript 0 is outside the bounds of an
                    interior zero-length array ‘struct lock_class_key[3]’
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com
  Target Milestone: ---

The linux kernel compile fails with gcc-13 in super.c with:

fs/super.c: In function ‘alloc_super.isra’:
fs/super.c:234:21: error: array subscript 2 is outside the bounds of an
interior zero-length array ‘struct lock_class_key[3]’
[-Werror=zero-length-bounds]
  234 |                 if (__percpu_init_rwsem(&s->s_writers.rw_sem[i],
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  235 |                                         sb_writers_name[i],
      |                                         ~~~~~~~~~~~~~~~~~~~
  236 |                                         &type->s_writers_key[i]))
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/highmem.h:5,
                 from ./include/linux/bvec.h:10,
                 from ./include/linux/blk_types.h:10,
                 from ./include/linux/blkdev.h:9,
                 from fs/super.c:26:
./include/linux/fs.h:2211:31: note: while referencing ‘s_writers_key’
 2211 |         struct lock_class_key s_writers_key[SB_FREEZE_LEVELS];
      |                               ^~~~~~~~~~~~~
cc1: all warnings being treated as errors

Reply via email to