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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Created attachment 48436
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48436&action=edit
Original test-case

$ gcc -c -O2 -Werror=array-bounds intelvf2.i -m32
intelvf2.i: In function ‘intelvf_mbox_poll’:
intelvf2.i:2658:13: error: array subscript i is outside array bounds of
‘uint32_t[0]’ {aka ‘unsigned int[]’} [-Werror=array-bounds]
 2658 |   msg->dword[i] = ( { volatile uint32_t *_io_addr = ( ( volatile
uint32_t * ) ( intptr_t ) (intel->regs + intel->mbox.mem + ( i * sizeof (
msg->dword[0] ) )) ); uint32_t _data = readl ( _io_addr ); do { if ( ( 0 & 8 )
) { dbg_printf ( "[" "MEM" " %08lx] => %0" "8" "llx\n", io_to_bus ( _io_addr ),
( unsigned long long ) _data ); } } while ( 0 ); _data; } )
      |   ~~~~~~~~~~^~~
intelvf2.i:2615:11: note: while referencing ‘dword’
 2615 |  uint32_t dword[0];
      |           ^~~~~
intelvf2.i:2666:20: note: defined here ‘msg’
 2666 |  union intelvf_msg msg;
      |                    ^~~
intelvf2.i: In function ‘intelvf_mbox_wait’:
intelvf2.i:2658:13: error: array subscript i is outside array bounds of
‘uint32_t[0]’ {aka ‘unsigned int[]’} [-Werror=array-bounds]
 2658 |   msg->dword[i] = ( { volatile uint32_t *_io_addr = ( ( volatile
uint32_t * ) ( intptr_t ) (intel->regs + intel->mbox.mem + ( i * sizeof (
msg->dword[0] ) )) ); uint32_t _data = readl ( _io_addr ); do { if ( ( 0 & 8 )
) { dbg_printf ( "[" "MEM" " %08lx] => %0" "8" "llx\n", io_to_bus ( _io_addr ),
( unsigned long long ) _data ); } } while ( 0 ); _data; } )
      |   ~~~~~~~~~~^~~
intelvf2.i:2615:11: note: while referencing ‘dword’
 2615 |  uint32_t dword[0];
      |           ^~~~~
intelvf2.i:2666:20: note: defined here ‘msg’
 2666 |  union intelvf_msg msg;
      |                    ^~~
cc1: some warnings being treated as errors

Reply via email to