SET_EXPR_LOCATION usage for unused tree?

Thomas Schwinge thomas@codesourcery.com
Thu Mar 13 21:45:00 GMT 2014


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)
                                  ^


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20140313/81af0977/attachment.sig>


More information about the Gcc mailing list