https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119000
Bug ID: 119000 Summary: [OpenMP] Function parameter incorrectly reported as set but not used. Product: gcc Version: 14.2.0 Status: UNCONFIRMED Keywords: diagnostic, openmp Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: zh at sanchez dot pm Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Build: x86_64-pc-linux-gnu Created attachment 60574 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60574&action=edit Input to and output from GCC In the following program, GCC 14.2.0 incorrectly reports the function parameter param1 as set but not used: int func1(int param1) { int var1; #pragma omp atomic write var1 = param1; return var1; } int main(void) { return 0; } Here is the compilation command producing the unjustified warning: $ gcc -fopenmp -Wall -Wextra main.c Here is the text of the unjustified warning; main.c: In function ‘func1’: main.c:1:15: warning: parameter ‘param1’ set but not used [-Wunused-but-set-parameter] 1 | int func1(int param1) { | ~~~~^~~~~~ I provided the output of the following commands as an attachment (in the file named input_and_output.txt): $ cat main.c $ gcc -v -save-temps -fopenmp -Wall -Wextra -o main main.c $ cat main.i