https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118579
Bug ID: 118579 Summary: [OpenMP] c-parser.cc: Improve location of c_parser_omp_variable_list for kind=0 Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: diagnostic, openmp Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org CC: parras at gcc dot gnu.org Target Milestone: --- tree list = c_parser_omp_variable_list (parser, loc, OMP_CLAUSE_ERROR, NULL_TREE); where kind = 0 (== OMP_CLAUSE_ERROR) has no location data for decls, which leads to bad error diagnostic, in particular with declare variant's adjust_args, cf. c_finish_omp_declare_variant, but also elsewhere. This has been fixed for C++ with: r15-6512-gcf94ba812ca496 OpenMP/C++: Store location in cp_parser_omp_var_list for kind=0 https://gcc.gnu.org/pipermail/gcc-patches/2025-January/672469.html The same fix should also be done for C! We may consider to also add a testcase for this...