https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111211
--- Comment #1 from Lehua Ding <lehua.ding at rivai dot ai> --- Reproduce: Compile Command: gcc -O3 -Wall -Wextra C Code: ``` #include <stdint.h> int foo (uint64_t ddr0_addr_access) { uint64_t check[1] = {0}; for (int k = 0; k < 7; k += 1) { asm volatile ("nop" : "=r"(check[k]) : "r"(ddr0_addr_access)); } return 0; } int foo2 (uint64_t ddr0_addr_access) { uint64_t check[1] = {0}; for (int k = 0; k < 8; k += 1) { asm volatile ("nop" : "=r"(check[k]) : "r"(ddr0_addr_access)); } return 0; } ``` Output: <source>: In function 'foo': <source>:9:41: warning: array subscript 1 is above array bounds of 'uint64_t[1]' {aka 'long unsigned int[1]'} [-Warray-bounds=] 9 | asm volatile ("nop" : "=r"(check[k]) : "r"(ddr0_addr_access)); | ~~~~~^~~ <source>:5:14: note: while referencing 'check' 5 | uint64_t check[1] = {0}; | ^~~~~ <source>:9:41: warning: array subscript 2 is above array bounds of 'uint64_t[1]' {aka 'long unsigned int[1]'} [-Warray-bounds=] 9 | asm volatile ("nop" : "=r"(check[k]) : "r"(ddr0_addr_access)); | ~~~~~^~~ <source>:5:14: note: while referencing 'check' 5 | uint64_t check[1] = {0}; | ^~~~~ <source>:9:41: warning: array subscript 3 is above array bounds of 'uint64_t[1]' {aka 'long unsigned int[1]'} [-Warray-bounds=] 9 | asm volatile ("nop" : "=r"(check[k]) : "r"(ddr0_addr_access)); | ~~~~~^~~ <source>:5:14: note: while referencing 'check' 5 | uint64_t check[1] = {0}; | ^~~~~ <source>:9:41: warning: array subscript 4 is above array bounds of 'uint64_t[1]' {aka 'long unsigned int[1]'} [-Warray-bounds=] 9 | asm volatile ("nop" : "=r"(check[k]) : "r"(ddr0_addr_access)); | ~~~~~^~~ <source>:5:14: note: while referencing 'check' 5 | uint64_t check[1] = {0}; | ^~~~~ <source>:9:41: warning: array subscript 5 is above array bounds of 'uint64_t[1]' {aka 'long unsigned int[1]'} [-Warray-bounds=] 9 | asm volatile ("nop" : "=r"(check[k]) : "r"(ddr0_addr_access)); | ~~~~~^~~ <source>:5:14: note: while referencing 'check' 5 | uint64_t check[1] = {0}; | ^~~~~ <source>:9:41: warning: array subscript 6 is above array bounds of 'uint64_t[1]' {aka 'long unsigned int[1]'} [-Warray-bounds=] 9 | asm volatile ("nop" : "=r"(check[k]) : "r"(ddr0_addr_access)); | ~~~~~^~~ <source>:5:14: note: while referencing 'check' 5 | uint64_t check[1] = {0}; | ^~~~~ Compiler returned: 0