aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTobias Burnus <tburnus@baylibre.com>2025-04-01 10:29:27 +0200
committerTobias Burnus <tburnus@baylibre.com>2025-04-01 10:29:27 +0200
commitde92ac6f11e605987421fe1443b5b81ff172dbb6 (patch)
tree22611fcbc6ea1f2a55d2b63e3a7fe2070ff53d13 /gcc
parent75a049483c9519e85521a4c903d4a40412b0b25f (diff)
downloadgcc-de92ac6f11e605987421fe1443b5b81ff172dbb6.zip
gcc-de92ac6f11e605987421fe1443b5b81ff172dbb6.tar.gz
gcc-de92ac6f11e605987421fe1443b5b81ff172dbb6.tar.bz2
OpenMP: Reorder diagnostic in modify_call_for_omp_dispatch [PR119559]
gcc/ChangeLog: PR middle-end/119559 * gimplify.cc (modify_call_for_omp_dispatch): Reorder checks to avoid asserts and bogus diagnostic.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gimplify.cc36
1 files changed, 16 insertions, 20 deletions
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index a8399dc..02ad398 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -3933,25 +3933,9 @@ modify_call_for_omp_dispatch (tree expr, tree dispatch_clauses,
the split between early/late resolution, etc instead of the code
as written by the user. */
if (dispatch_interop)
- {
- for (tree t = dispatch_interop; t; t = TREE_CHAIN (t))
- if (OMP_CLAUSE_CODE (t) == OMP_CLAUSE_INTEROP)
- ninterop++;
- if (nappend < ninterop)
- {
- error_at (OMP_CLAUSE_LOCATION (dispatch_interop),
- "number of list items in %<interop%> clause (%d) "
- "exceeds the number of %<append_args%> items (%d) for "
- "%<declare variant%> candidate %qD",
- ninterop, nappend, fndecl);
- inform (dispatch_append_args
- ? EXPR_LOCATION (TREE_PURPOSE (dispatch_append_args))
- : DECL_SOURCE_LOCATION (fndecl),
- "%<declare variant%> candidate %qD declared here",
- fndecl);
- ninterop = nappend;
- }
- }
+ for (tree t = dispatch_interop; t; t = TREE_CHAIN (t))
+ if (OMP_CLAUSE_CODE (t) == OMP_CLAUSE_INTEROP)
+ ninterop++;
if (dispatch_interop && !dispatch_device_num)
{
gcc_checking_assert (ninterop > 1);
@@ -3959,7 +3943,19 @@ modify_call_for_omp_dispatch (tree expr, tree dispatch_clauses,
"the %<device%> clause must be present if the %<interop%> "
"clause has more than one list item");
}
- else if (dispatch_append_args)
+ if (nappend < ninterop)
+ {
+ error_at (OMP_CLAUSE_LOCATION (dispatch_interop),
+ "number of list items in %<interop%> clause (%d) "
+ "exceeds the number of %<append_args%> items (%d) for "
+ "%<declare variant%> candidate %qD", ninterop, nappend, fndecl);
+ inform (dispatch_append_args
+ ? EXPR_LOCATION (TREE_PURPOSE (dispatch_append_args))
+ : DECL_SOURCE_LOCATION (fndecl),
+ "%<declare variant%> candidate %qD declared here", fndecl);
+ ninterop = nappend;
+ }
+ if (dispatch_append_args)
{
tree *buffer = XALLOCAVEC (tree, nargs + nappend);
tree arg = TYPE_ARG_TYPES (TREE_TYPE (fndecl));