gcc 10.1.0 snprintf warning
Created by: Biswa96
This project can not be built in Linux due to usage of same buffer in source and destination in snprintf()
. Here are the points:
- System: ArchLinux X86_64
- Compiler: gcc version 10.1.0 (GCC) Target: x86_64-pc-linux-gnu
- Source version: latest master branch
- Used command:
mkdir build; cd build; cmake ../dynamorio/; make
- Compiler error:
In file included from dynamorio/tools/drdeploy.c:67:
dynamorio/tools/drdeploy.c: In function ‘append_client’:
dynamorio/libutil/dr_frontend.h:108:23: error: ‘snprintf’ argument 4 may overlap destination object ‘client_paths’ [-Werror=restrict]
108 | # define _snprintf snprintf
dynamorio/tools/drdeploy.c:751:9: note: in expansion of macro ‘_snprintf’
751 | _snprintf(client_paths[index], BUFFER_SIZE_ELEMENTS(client_paths[index]), "%s",
| ^~~~~~~~~
dynamorio/tools/drdeploy.c:737:20: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here
737 | char client_paths[MAX_CLIENT_LIBS][MAXIMUM_PATH],
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors