On Thu, Mar 13, 2014 at 10:44 PM, Thomas Schwinge <tho...@codesourcery.com> wrote: > Hi! > > 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 with c = fold_binary (LE_EXPR, boolean_type_node, t, build_int_cst (TREE_TYPE (t), 0)); if (c && c == boolean_true_node) { warning_at (.... Richard. > > Grüße, > Thomas