C C++ Var(warn_openacc_parallelism) Warning
Warn about potentially suboptimal choices related to OpenACC parallelism.
+Wopenmp
+C ObjC C++ ObjC++ Warning Var(warn_openmp) Init(1)
+Warn about suspicious OpenMP code
+
Wopenmp-simd
C C++ Var(warn_openmp_simd) Warning LangEnabledBy(C C++,Wall)
Warn if a simd directive is overridden by the vectorizer cost model.
protected_set_expr_location (c, expr_loc);
if (c == boolean_true_node)
{
- warning_at (expr_loc, 0,
+ warning_at (expr_loc, OPT_Wopenmp,
"%<num_threads%> value must be positive");
t = integer_one_node;
}
SET_EXPR_LOCATION (c, expr_loc);
if (c == boolean_true_node)
{
- warning_at (expr_loc, 0, "%<num_tasks%> value must be positive");
+ warning_at (expr_loc, OPT_Wopenmp,
+ "%<num_tasks%> value must be positive");
t = integer_one_node;
}
SET_EXPR_LOCATION (c, expr_loc);
if (c == boolean_true_node)
{
- warning_at (expr_loc, 0, "%<grainsize%> value must be positive");
+ warning_at (expr_loc, OPT_Wopenmp,
+ "%<grainsize%> value must be positive");
t = integer_one_node;
}
SET_EXPR_LOCATION (c, expr_loc);
if (c == boolean_true_node)
{
- warning_at (expr_loc, 0, "%<priority%> value must be non-negative");
+ warning_at (expr_loc, OPT_Wopenmp,
+ "%<priority%> value must be non-negative");
t = integer_one_node;
}
protected_set_expr_location (s, loc);
if (s == boolean_true_node)
{
- warning_at (loc, 0,
+ warning_at (loc, OPT_Wopenmp,
"chunk size value must be positive");
t = integer_one_node;
}
protected_set_expr_location (c, upper_loc);
if (c == boolean_true_node)
{
- warning_at (upper_loc, 0, "%<num_teams%> value must be positive");
+ warning_at (upper_loc, OPT_Wopenmp,
+ "%<num_teams%> value must be positive");
upper = integer_one_node;
}
if (lower)
protected_set_expr_location (c, lower_loc);
if (c == boolean_true_node)
{
- warning_at (lower_loc, 0, "%<num_teams%> value must be positive");
+ warning_at (lower_loc, OPT_Wopenmp,
+ "%<num_teams%> value must be positive");
lower = NULL_TREE;
}
else if (TREE_CODE (lower) == INTEGER_CST
&& TREE_CODE (upper) == INTEGER_CST
&& tree_int_cst_lt (upper, lower))
{
- warning_at (lower_loc, 0, "%<num_teams%> lower bound %qE bigger "
- "than upper bound %qE", lower, upper);
+ warning_at (lower_loc, OPT_Wopenmp,
+ "%<num_teams%> lower bound %qE bigger than upper "
+ "bound %qE", lower, upper);
lower = NULL_TREE;
}
}
protected_set_expr_location (c, expr_loc);
if (c == boolean_true_node)
{
- warning_at (expr_loc, 0, "%<thread_limit%> value must be positive");
+ warning_at (expr_loc, OPT_Wopenmp,
+ "%<thread_limit%> value must be positive");
t = integer_one_node;
}
/* check_no_duplicate_clause (list, OMP_CLAUSE_DIST_SCHEDULE,
"dist_schedule"); */
if (omp_find_clause (list, OMP_CLAUSE_DIST_SCHEDULE))
- warning_at (loc, 0, "too many %qs clauses", "dist_schedule");
+ warning_at (loc, OPT_Wopenmp, "too many %qs clauses", "dist_schedule");
if (t == error_mark_node)
return list;
&& !operand_equal_p (destobj, depobj,
OEP_MATCH_SIDE_EFFECTS
| OEP_LEXICOGRAPHIC))
- warning_at (EXPR_LOC_OR_LOC (destobj, c_loc), 0,
+ warning_at (EXPR_LOC_OR_LOC (destobj, c_loc), OPT_Wopenmp,
"the %<destroy%> expression %qE should be the same "
"as the %<depobj%> argument %qE", destobj, depobj);
c_parens.skip_until_found_close (parser);
substmt = c_parser_omp_structured_block_sequence (parser, PRAGMA_OMP_SCAN);
else
{
- warning_at (c_parser_peek_token (parser)->location, 0,
+ warning_at (c_parser_peek_token (parser)->location, OPT_Wopenmp,
"%<#pragma omp scan%> with zero preceding executable "
"statements");
substmt = build_empty_stmt (loc);
else
{
if (found_scan)
- warning_at (loc, 0, "%<#pragma omp scan%> with zero succeeding "
- "executable statements");
+ warning_at (loc, OPT_Wopenmp,
+ "%<#pragma omp scan%> with zero succeeding executable "
+ "statements");
substmt = build_empty_stmt (loc);
}
substmt = build2 (OMP_SCAN, void_type_node, substmt, clauses);
}
else if (startswith (p, "ext_"))
{
- warning_at (cloc, 0, "unknown assumption clause %qs", p);
+ warning_at (cloc, OPT_Wopenmp, "unknown assumption clause %qs", p);
c_parser_consume_token (parser);
if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
{
/* check_no_duplicate_clause (list, OMP_CLAUSE_DIST_SCHEDULE,
"dist_schedule", location); */
if (omp_find_clause (list, OMP_CLAUSE_DIST_SCHEDULE))
- warning_at (location, 0, "too many %qs clauses", "dist_schedule");
+ warning_at (location, OPT_Wopenmp, "too many %qs clauses", "dist_schedule");
OMP_CLAUSE_CHAIN (c) = list;
return c;
&& destobj != error_mark_node
&& !operand_equal_p (destobj, depobj, OEP_MATCH_SIDE_EFFECTS
| OEP_LEXICOGRAPHIC))
- warning_at (EXPR_LOC_OR_LOC (destobj, c_loc), 0,
+ warning_at (EXPR_LOC_OR_LOC (destobj, c_loc), OPT_Wopenmp,
"the %<destroy%> expression %qE should be the same "
"as the %<depobj%> argument %qE", destobj, depobj);
if (!c_parens.require_close (parser))
substmt = cp_parser_omp_structured_block_sequence (parser, PRAGMA_OMP_SCAN);
else
{
- warning_at (tok->location, 0, "%<#pragma omp scan%> with zero preceding "
- "executable statements");
+ warning_at (tok->location, OPT_Wopenmp,
+ "%<#pragma omp scan%> with zero preceding executable "
+ "statements");
substmt = build_empty_stmt (tok->location);
}
substmt = build2 (OMP_SCAN, void_type_node, substmt, NULL_TREE);
else
{
if (found_scan)
- warning_at (tok->location, 0, "%<#pragma omp scan%> with zero "
- "succeeding executable statements");
+ warning_at (tok->location, OPT_Wopenmp,
+ "%<#pragma omp scan%> with zero succeeding executable "
+ "statements");
substmt = build_empty_stmt (tok->location);
}
substmt = build2_loc (tok->location, OMP_SCAN, void_type_node, substmt,
}
else if (startswith (p, "ext_"))
{
- warning_at (cloc, 0, "unknown assumption clause %qs", p);
+ warning_at (cloc, OPT_Wopenmp, "unknown assumption clause %qs", p);
cp_lexer_consume_token (parser->lexer);
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
for (size_t n = cp_parser_skip_balanced_tokens (parser, 1) - 1;
"positive");
break;
default:
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c),
+ (flag_openmp || flag_openmp_simd)
+ ? OPT_Wopenmp : 0,
"%qs value must be positive",
omp_clause_code_name
[OMP_CLAUSE_CODE (c)]);
if (TREE_CODE (t) == INTEGER_CST
&& tree_int_cst_sgn (t) != 1)
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"%qs value must be positive",
omp_clause_code_name
[OMP_CLAUSE_CODE (c)]);
&& TREE_CODE (upper) == INTEGER_CST
&& tree_int_cst_lt (upper, t))
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"%<num_teams%> lower bound %qE bigger "
"than upper bound %qE", t, upper);
t = NULL_TREE;
if (TREE_CODE (t) == INTEGER_CST
&& tree_int_cst_sgn (t) != 1)
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"chunk size value must be positive");
t = integer_one_node;
}
if (TREE_CODE (t) == INTEGER_CST
&& tree_int_cst_sgn (t) != 1)
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"%<thread_limit%> value must be positive");
t = integer_one_node;
}
}
else if (bitmap_bit_p (&aligned_head, DECL_UID (t)))
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"%qD appears more than once in %<allocate%> clauses",
t);
remove = true;
if (TREE_CODE (t) == INTEGER_CST
&& tree_int_cst_sgn (t) != 1)
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"%<grainsize%> value must be positive");
t = integer_one_node;
}
if (TREE_CODE (t) == INTEGER_CST
&& tree_int_cst_sgn (t) == -1)
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
"%<priority%> value must be non-negative");
t = integer_one_node;
}
-Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
-Wnull-dereference -Wno-odr
-Wopenacc-parallelism
--Wopenmp-simd
+-Wopenmp -Wopenmp-simd
-Wno-overflow -Woverlength-strings -Wno-override-init-side-effects
-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
-Wparentheses -Wno-pedantic-ms-format
@item -Wopenacc-parallelism
Warn about potentially suboptimal choices related to OpenACC parallelism.
+@opindex Wopenmp
+@opindex Wno-openmp
+@item -Wno-openmp
+Warn about suspicious OpenMP code.
+
@opindex Wopenmp-simd
@opindex Wno-openmp-simd
@item -Wopenmp-simd
Fortran
; Documented in C
+Wopenmp
+Fortran
+; Documented in C
+
Wopenmp-simd
Fortran
; Documented in C
#include "config.h"
#include "system.h"
#include "coretypes.h"
+#include "options.h"
#include "gfortran.h"
#include "arith.h"
#include "match.h"
&& !c->lists[OMP_LIST_ENTER]
&& !c->lists[OMP_LIST_TO]
&& !c->lists[OMP_LIST_LINK])
- gfc_warning_now (0, "OMP DECLARE TARGET directive at %L with only "
- "DEVICE_TYPE clause is ignored", &old_loc);
+ gfc_warning_now (OPT_Wopenmp,
+ "OMP DECLARE TARGET directive at %L with only "
+ "DEVICE_TYPE clause is ignored", &old_loc);
gfc_buffer_error (true);
if (expr->expr_type == EXPR_CONSTANT
&& expr->ts.type == BT_INTEGER
&& mpz_sgn (expr->value.integer) <= 0)
- gfc_warning (0, "INTEGER expression of %s clause at %L must be positive",
+ gfc_warning ((flag_openmp || flag_openmp_simd) ? OPT_Wopenmp : 0,
+ "INTEGER expression of %s clause at %L must be positive",
clause, &expr->where);
}
if (expr->expr_type == EXPR_CONSTANT
&& expr->ts.type == BT_INTEGER
&& mpz_sgn (expr->value.integer) < 0)
- gfc_warning (0, "INTEGER expression of %s clause at %L must be "
- "non-negative", clause, &expr->where);
+ gfc_warning ((flag_openmp || flag_openmp_simd) ? OPT_Wopenmp : 0,
+ "INTEGER expression of %s clause at %L must be non-negative",
+ clause, &expr->where);
}
/* Emits error when symbol is pointer, cray pointer or cray pointee
else if (expr->expr_type == EXPR_CONSTANT
&& expr->ts.type == BT_INTEGER
&& mpz_sgn (expr->value.integer) <= 0)
- gfc_warning (0, "INTEGER expression of SCHEDULE clause's chunk_size "
- "at %L must be positive", &expr->where);
+ gfc_warning (OPT_Wopenmp, "INTEGER expression of SCHEDULE clause's "
+ "chunk_size at %L must be positive", &expr->where);
}
if (omp_clauses->sched_kind != OMP_SCHED_NONE
&& omp_clauses->sched_nonmonotonic)
}
if (n->sym->mark == 1)
{
- gfc_warning (0, "%qs appears more than once in %<allocate%> "
- "at %L" , n->sym->name, &n->where);
+ gfc_warning (OPT_Wopenmp, "%qs appears more than once in "
+ "%<allocate%> at %L" , n->sym->name, &n->where);
/* We have already seen this variable so it is a duplicate.
Remove it. */
if (prev != NULL && prev->next == n)
&& omp_clauses->num_teams_upper->expr_type == EXPR_CONSTANT
&& mpz_cmp (omp_clauses->num_teams_lower->value.integer,
omp_clauses->num_teams_upper->value.integer) > 0)
- gfc_warning (0, "NUM_TEAMS lower bound at %L larger than upper bound at %L",
- &omp_clauses->num_teams_lower->where,
+ gfc_warning (OPT_Wopenmp, "NUM_TEAMS lower bound at %L larger than upper "
+ "bound at %L", &omp_clauses->num_teams_lower->where,
&omp_clauses->num_teams_upper->where);
if (omp_clauses->device)
resolve_scalar_int_expr (omp_clauses->device, "DEVICE");
else
{
if (block->op == EXEC_OMP_SCAN)
- gfc_warning (0, "!$OMP SCAN at %L with zero executable "
+ gfc_warning (OPT_Wopenmp,
+ "!$OMP SCAN at %L with zero executable "
"statements in preceding structured block "
"sequence", &block->loc);
if ((block->op == EXEC_OMP_SCAN && !block->next)
|| (block->next && block->next->op == EXEC_OMP_SCAN
&& !block->next->next))
- gfc_warning (0, "!$OMP SCAN at %L with zero executable "
+ gfc_warning (OPT_Wopenmp,
+ "!$OMP SCAN at %L with zero executable "
"statements in succeeding structured block "
"sequence", block->op == EXEC_OMP_SCAN
? &block->loc : &block->next->loc);
OMP_CLAUSE_LASTPRIVATE))
if (OMP_CLAUSE_DECL (c3) == decl)
{
- warning_at (OMP_CLAUSE_LOCATION (c3), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c3), OPT_Wopenmp,
"conditional %<lastprivate%> on loop "
"iterator %qD ignored", decl);
OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c3) = 0;
OMP_CLAUSE_LASTPRIVATE))
if (OMP_CLAUSE_DECL (c3) == decl)
{
- warning_at (OMP_CLAUSE_LOCATION (c3), 0,
+ warning_at (OMP_CLAUSE_LOCATION (c3), OPT_Wopenmp,
"conditional %<lastprivate%> on loop "
"iterator %qD ignored", decl);
OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (c3) = 0;
forward = tree_int_cst_sgn (step) != -1;
}
if (forward ^ OMP_CLAUSE_DOACROSS_SINK_NEGATIVE (deps))
- warning_at (loc, 0, "%qs clause with %<sink%> modifier "
- "waiting for lexically later iteration",
+ warning_at (loc, OPT_Wopenmp,
+ "%qs clause with %<sink%> modifier "
+ "waiting for lexically later iteration",
OMP_CLAUSE_DOACROSS_DEPEND (c)
? "depend" : "doacross");
break;
build_int_cst (itype, 0));
if (integer_zerop (t) && !warned_step)
{
- warning_at (loc, 0, "%qs clause with %<sink%> modifier "
- "refers to iteration never in the iteration "
- "space",
+ warning_at (loc, OPT_Wopenmp,
+ "%qs clause with %<sink%> modifier refers to "
+ "iteration never in the iteration space",
OMP_CLAUSE_DOACROSS_DEPEND (c)
? "depend" : "doacross");
warned_step = true;
return error_mark_node;
}
else if (TREE_PURPOSE (t2))
- warning_at (loc, 0,
+ warning_at (loc, OPT_Wopenmp,
"unknown property %qs of %qs selector",
IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
props[i].selector);
else
- warning_at (loc, 0,
+ warning_at (loc, OPT_Wopenmp,
"unknown property %qE of %qs selector",
TREE_VALUE (t2), props[i].selector);
break;
tree_code outer_op = OMP_CLAUSE_REDUCTION_CODE (outer_clause);
if (outer_var == local_var && outer_op != local_op)
{
- warning_at (OMP_CLAUSE_LOCATION (local_clause), 0,
- "conflicting reduction operations for %qE",
- local_var);
- inform (OMP_CLAUSE_LOCATION (outer_clause),
- "location of the previous reduction for %qE",
- outer_var);
+ if (warning_at (OMP_CLAUSE_LOCATION (local_clause),
+ OPT_Wopenmp, "conflicting reduction "
+ "operations for %qE",
+ local_var))
+ inform (OMP_CLAUSE_LOCATION (outer_clause),
+ "location of the previous reduction for %qE",
+ outer_var);
}
if (outer_var == local_var)
{
}
}
if (!found)
- warning_at (gimple_location (curr_loop->stmt), 0,
+ warning_at (gimple_location (curr_loop->stmt), OPT_Wopenmp,
"nested loop in reduction needs "
"reduction clause for %qE",
local_var);
ctx->cancellable = true;
if (omp_find_clause (gimple_omp_for_clauses (ctx->stmt),
OMP_CLAUSE_NOWAIT))
- warning_at (gimple_location (stmt), 0,
+ warning_at (gimple_location (stmt), OPT_Wopenmp,
"%<cancel for%> inside "
"%<nowait%> for construct");
if (omp_find_clause (gimple_omp_for_clauses (ctx->stmt),
OMP_CLAUSE_ORDERED))
- warning_at (gimple_location (stmt), 0,
+ warning_at (gimple_location (stmt), OPT_Wopenmp,
"%<cancel for%> inside "
"%<ordered%> for construct");
}
if (omp_find_clause (gimple_omp_sections_clauses
(ctx->stmt),
OMP_CLAUSE_NOWAIT))
- warning_at (gimple_location (stmt), 0,
+ warning_at (gimple_location (stmt), OPT_Wopenmp,
"%<cancel sections%> inside "
"%<nowait%> sections construct");
}
if (omp_find_clause (gimple_omp_sections_clauses
(ctx->outer->stmt),
OMP_CLAUSE_NOWAIT))
- warning_at (gimple_location (stmt), 0,
+ warning_at (gimple_location (stmt), OPT_Wopenmp,
"%<cancel sections%> inside "
"%<nowait%> sections construct");
}
if (c && OMP_CLAUSE_DEVICE_ANCESTOR (c))
break;
}
- warning_at (gimple_location (stmt), 0,
+ warning_at (gimple_location (stmt), OPT_Wopenmp,
"%qs construct inside of %qs region",
stmt_name, ctx_stmt_name);
}
wi::abs (wi::to_wide (fd.loops[i].step)),
UNSIGNED))
{
- warning_at (OMP_CLAUSE_LOCATION (c), 0,
- "ignoring sink clause with offset that is not "
+ warning_at (OMP_CLAUSE_LOCATION (c), OPT_Wopenmp,
+ "ignoring %<sink%> clause with offset that is not "
"a multiple of the loop step");
remove = true;
goto next_ordered_clause;
step = fold_convert (ssizetype, step);
if (!tree_fits_shwi_p (step))
{
- warning_at (OMP_CLAUSE_LOCATION (t), 0,
+ warning_at (OMP_CLAUSE_LOCATION (t), OPT_Wopenmp,
"ignoring large linear step");
return NULL;
}
else if (integer_zerop (step))
{
- warning_at (OMP_CLAUSE_LOCATION (t), 0,
+ warning_at (OMP_CLAUSE_LOCATION (t), OPT_Wopenmp,
"ignoring zero linear step");
return NULL;
}
out:
if (TYPE_ATOMIC (TREE_TYPE (TREE_TYPE (node->decl))))
{
- warning_at (DECL_SOURCE_LOCATION (node->decl), 0,
+ warning_at (DECL_SOURCE_LOCATION (node->decl), OPT_Wopenmp,
"ignoring %<#pragma omp declare simd%> on function "
"with %<_Atomic%> qualified return type");
return NULL;
if (TYPE_ATOMIC (args[argno])
&& clone_info->args[argno].arg_type != SIMD_CLONE_ARG_TYPE_UNIFORM)
{
- warning_at (DECL_SOURCE_LOCATION (node->decl), 0,
+ warning_at (DECL_SOURCE_LOCATION (node->decl), OPT_Wopenmp,
"ignoring %<#pragma omp declare simd%> on function "
"with %<_Atomic%> qualified non-%<uniform%> argument");
args.release ();