* SET_EXPR_LOCATION usage for unused tree?
@ 2014-03-13 21:45 Thomas Schwinge
2014-03-14 10:01 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Schwinge @ 2014-03-13 21:45 UTC (permalink / raw)
To: gcc
[-- Attachment #1: Type: text/plain, Size: 1054 bytes --]
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
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: SET_EXPR_LOCATION usage for unused tree?
2014-03-13 21:45 SET_EXPR_LOCATION usage for unused tree? Thomas Schwinge
@ 2014-03-14 10:01 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2014-03-14 10:01 UTC (permalink / raw)
To: Thomas Schwinge; +Cc: GCC Development
On Thu, Mar 13, 2014 at 10:44 PM, Thomas Schwinge
<thomas@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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-14 10:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-13 21:45 SET_EXPR_LOCATION usage for unused tree? Thomas Schwinge
2014-03-14 10:01 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).