This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Compiler generates warning " __builtin_memcpy' writing 31 bytes into a region of size 0 overflows the destination" when compiling Dhrystone with 11.2 compiler

Hi,

We are using the following GCC 11.2 compiler to compile the Dhrystone benchmark

https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/downloads

Dhrystone

https://github.com/sifive/benchmark-dhrystone/blob/master/dhry_1.c

The compiler generates the following warning

 warning: '__builtin_memcpy' writing 31 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]

strcpy (Ptr_Glob->variant.var_1.Str_Comp,

 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 "DHRYSTONE PROGRAM, SOME STRING");

We use the following command to compile.

aarch64-none-elf-gcc -c -O3 dhry.c

Why does the compile generate the warning and how to get rid of the warning? 

Thanks,

Sugumar

 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~