This is the mail archive of the
mailing list for the GCC project.
Re: SET_EXPR_LOCATION usage for unused tree?
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Thomas Schwinge <thomas at codesourcery dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Fri, 14 Mar 2014 11:01:22 +0100
- Subject: Re: SET_EXPR_LOCATION usage for unused tree?
- Authentication-results: sourceware.org; auth=none
- References: <87iorhlqnk dot fsf at schwinge dot name>
On Thu, Mar 13, 2014 at 10:44 PM, Thomas Schwinge
> In gcc/c/c-parser.c:c_parser_omp_clause_num_threads (as well as other,
> similar functions), what is the point of setting the boolean tree c's
> location, given that this tree won't be used in the following?
> /* Attempt to statically determine when the number isn't positive. */
> c = fold_build2_loc (expr_loc, LE_EXPR, boolean_type_node, t,
> build_int_cst (TREE_TYPE (t), 0));
> if (CAN_HAVE_LOCATION_P (c))
> SET_EXPR_LOCATION (c, expr_loc);
> if (c == boolean_true_node)
> warning_at (expr_loc, 0,
> "%<num_threads%> value must be positive");
> t = integer_one_node;
> [c not used anymore]
> Both with and without the SET_EXPR_LOCATION, the error is the same:
> ../../loop.c: In function 'main':
> ../../loop.c:10:34: warning: 'num_threads' value must be positive
> #pragma omp parallel num_threads(-1)
That can be even simplified to avoid building the tree if it doesn't simplify
c = fold_binary (LE_EXPR, boolean_type_node, t, build_int_cst
(TREE_TYPE (t), 0));
if (c && c == boolean_true_node)