re PR fortran/45186 (Gfortran 4.5.0 emits wrong linenumbers)
2010-09-10 Tobias Burnus <burnus@net-b.de> PR fortran/45186 * trans.h (build1_stat_loc, build2_stat_loc, build3_stat_loc, build4_stat_loc): New inline functions. (build1_loc, build2_loc, build3_loc, build4_loc): New macros. (build1_v, build2_v, build3_v, build4_v): Use input_location as locus. * trans-array.c (gfc_trans_scalarized_loop_end, gfc_conv_array_parameter): Replace build[1-4] by build[1-4]_loc. * trans.c (gfc_build_addr_expr, gfc_build_array_ref, gfc_finish_wrapped_block): Ditto. * trans-decl.c (gfc_init_default_dt, init_intent_out_dt): Ditto. * trans-expr.c (gfc_conv_missing_dummy, gfc_trans_alloc_subarray_assign, gfc_trans_zero_assign): Ditto. * trans-openmp.c (gfc_omp_clause_default_ctor, gfc_trans_omp_critical, gfc_trans_omp_parallel, gfc_trans_omp_parallel_do, gfc_trans_omp_parallel_sections, gfc_trans_omp_parallel_workshare, gfc_trans_omp_sections gfc_trans_omp_single, gfc_trans_omp_task, gfc_trans_omp_workshare): Ditto. From-SVN: r164143
This commit is contained in:
parent
63d1822fcc
commit
5d44e5c839
|
@ -1,3 +1,25 @@
|
|||
2010-09-10 Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
PR fortran/45186
|
||||
* trans.h (build1_stat_loc, build2_stat_loc, build3_stat_loc,
|
||||
build4_stat_loc): New inline functions.
|
||||
(build1_loc, build2_loc, build3_loc, build4_loc): New macros.
|
||||
(build1_v, build2_v, build3_v, build4_v): Use input_location
|
||||
as locus.
|
||||
* trans-array.c (gfc_trans_scalarized_loop_end,
|
||||
gfc_conv_array_parameter): Replace build[1-4] by build[1-4]_loc.
|
||||
* trans.c (gfc_build_addr_expr, gfc_build_array_ref,
|
||||
gfc_finish_wrapped_block): Ditto.
|
||||
* trans-decl.c (gfc_init_default_dt, init_intent_out_dt): Ditto.
|
||||
* trans-expr.c (gfc_conv_missing_dummy,
|
||||
gfc_trans_alloc_subarray_assign, gfc_trans_zero_assign): Ditto.
|
||||
* trans-openmp.c (gfc_omp_clause_default_ctor,
|
||||
gfc_trans_omp_critical, gfc_trans_omp_parallel,
|
||||
gfc_trans_omp_parallel_do, gfc_trans_omp_parallel_sections,
|
||||
gfc_trans_omp_parallel_workshare, gfc_trans_omp_sections
|
||||
gfc_trans_omp_single, gfc_trans_omp_task,
|
||||
gfc_trans_omp_workshare): Ditto.
|
||||
|
||||
2010-09-09 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
* fortran/expr.c (check_inquiry): OPTIONAL attribute is not allowed
|
||||
|
|
|
@ -2944,12 +2944,14 @@ gfc_trans_scalarized_loop_end (gfc_loopinfo * loop, int n,
|
|||
loop->from[n]);
|
||||
OMP_FOR_INIT (stmt) = init;
|
||||
/* The exit condition. */
|
||||
TREE_VEC_ELT (cond, 0) = build2 (LE_EXPR, boolean_type_node,
|
||||
loop->loopvar[n], loop->to[n]);
|
||||
TREE_VEC_ELT (cond, 0) = build2_loc (input_location, LE_EXPR,
|
||||
boolean_type_node,
|
||||
loop->loopvar[n], loop->to[n]);
|
||||
SET_EXPR_LOCATION (TREE_VEC_ELT (cond, 0), input_location);
|
||||
OMP_FOR_COND (stmt) = cond;
|
||||
/* Increment the loopvar. */
|
||||
tmp = build2 (PLUS_EXPR, gfc_array_index_type,
|
||||
loop->loopvar[n], gfc_index_one_node);
|
||||
tmp = build2_loc (input_location, PLUS_EXPR, gfc_array_index_type,
|
||||
loop->loopvar[n], gfc_index_one_node);
|
||||
TREE_VEC_ELT (incr, 0) = fold_build2_loc (input_location, MODIFY_EXPR,
|
||||
void_type_node, loop->loopvar[n], tmp);
|
||||
OMP_FOR_INCR (stmt) = incr;
|
||||
|
@ -5931,8 +5933,8 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, bool g77,
|
|||
if (fsym && fsym->attr.optional && sym && sym->attr.optional)
|
||||
{
|
||||
tmp = gfc_conv_expr_present (sym);
|
||||
ptr = build3 (COND_EXPR, TREE_TYPE (se->expr), tmp,
|
||||
fold_convert (TREE_TYPE (se->expr), ptr),
|
||||
ptr = build3_loc (input_location, COND_EXPR, TREE_TYPE (se->expr),
|
||||
tmp, fold_convert (TREE_TYPE (se->expr), ptr),
|
||||
fold_convert (TREE_TYPE (se->expr), null_pointer_node));
|
||||
}
|
||||
|
||||
|
|
|
@ -3083,8 +3083,8 @@ gfc_init_default_dt (gfc_symbol * sym, stmtblock_t * block, bool dealloc)
|
|||
|| sym->ns->proc_name->attr.entry_master))
|
||||
{
|
||||
present = gfc_conv_expr_present (sym);
|
||||
tmp = build3 (COND_EXPR, TREE_TYPE (tmp), present,
|
||||
tmp, build_empty_stmt (input_location));
|
||||
tmp = build3_loc (input_location, COND_EXPR, TREE_TYPE (tmp), present,
|
||||
tmp, build_empty_stmt (input_location));
|
||||
}
|
||||
gfc_add_expr_to_block (block, tmp);
|
||||
gfc_free_expr (e);
|
||||
|
@ -3119,8 +3119,9 @@ init_intent_out_dt (gfc_symbol * proc_sym, gfc_wrapped_block * block)
|
|||
|| f->sym->ns->proc_name->attr.entry_master)
|
||||
{
|
||||
present = gfc_conv_expr_present (f->sym);
|
||||
tmp = build3 (COND_EXPR, TREE_TYPE (tmp), present,
|
||||
tmp, build_empty_stmt (input_location));
|
||||
tmp = build3_loc (input_location, COND_EXPR, TREE_TYPE (tmp),
|
||||
present, tmp,
|
||||
build_empty_stmt (input_location));
|
||||
}
|
||||
|
||||
gfc_add_expr_to_block (&init, tmp);
|
||||
|
|
|
@ -178,15 +178,16 @@ gfc_conv_missing_dummy (gfc_se * se, gfc_expr * arg, gfc_typespec ts, int kind)
|
|||
se->expr));
|
||||
|
||||
/* Test for a NULL value. */
|
||||
tmp = build3 (COND_EXPR, TREE_TYPE (tmp), present, tmp,
|
||||
fold_convert (TREE_TYPE (tmp), integer_one_node));
|
||||
tmp = build3_loc (input_location, COND_EXPR, TREE_TYPE (tmp), present,
|
||||
tmp, fold_convert (TREE_TYPE (tmp), integer_one_node));
|
||||
tmp = gfc_evaluate_now (tmp, &se->pre);
|
||||
se->expr = gfc_build_addr_expr (NULL_TREE, tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = build3 (COND_EXPR, TREE_TYPE (se->expr), present, se->expr,
|
||||
fold_convert (TREE_TYPE (se->expr), integer_zero_node));
|
||||
tmp = build3_loc (input_location, COND_EXPR, TREE_TYPE (se->expr),
|
||||
present, se->expr,
|
||||
fold_convert (TREE_TYPE (se->expr), integer_zero_node));
|
||||
tmp = gfc_evaluate_now (tmp, &se->pre);
|
||||
se->expr = tmp;
|
||||
}
|
||||
|
@ -4299,9 +4300,8 @@ gfc_trans_alloc_subarray_assign (tree dest, gfc_component * cm,
|
|||
null_pointer_node);
|
||||
null_expr = gfc_finish_block (&block);
|
||||
tmp = gfc_conv_descriptor_data_get (arg->symtree->n.sym->backend_decl);
|
||||
tmp = build2 (EQ_EXPR, boolean_type_node, tmp,
|
||||
fold_convert (TREE_TYPE (tmp),
|
||||
null_pointer_node));
|
||||
tmp = build2_loc (input_location, EQ_EXPR, boolean_type_node, tmp,
|
||||
fold_convert (TREE_TYPE (tmp), null_pointer_node));
|
||||
return build3_v (COND_EXPR, tmp,
|
||||
null_expr, non_null_expr);
|
||||
}
|
||||
|
@ -5396,8 +5396,8 @@ gfc_trans_zero_assign (gfc_expr * expr)
|
|||
/* If we are zeroing a local array avoid taking its address by emitting
|
||||
a = {} instead. */
|
||||
if (!POINTER_TYPE_P (TREE_TYPE (dest)))
|
||||
return build2 (MODIFY_EXPR, void_type_node,
|
||||
dest, build_constructor (TREE_TYPE (dest), NULL));
|
||||
return build2_loc (input_location, MODIFY_EXPR, void_type_node,
|
||||
dest, build_constructor (TREE_TYPE (dest), NULL));
|
||||
|
||||
/* Convert arguments to the correct types. */
|
||||
dest = fold_convert (pvoid_type_node, dest);
|
||||
|
|
|
@ -202,8 +202,8 @@ gfc_omp_clause_default_ctor (tree clause, tree decl, tree outer)
|
|||
fold_convert (pvoid_type_node,
|
||||
gfc_conv_descriptor_data_get (outer)),
|
||||
null_pointer_node);
|
||||
gfc_add_expr_to_block (&block, build3 (COND_EXPR, void_type_node,
|
||||
cond, then_b, else_b));
|
||||
gfc_add_expr_to_block (&block, build3_loc (input_location, COND_EXPR,
|
||||
void_type_node, cond, then_b, else_b));
|
||||
|
||||
return gfc_finish_block (&block);
|
||||
}
|
||||
|
@ -1155,7 +1155,7 @@ gfc_trans_omp_critical (gfc_code *code)
|
|||
if (code->ext.omp_name != NULL)
|
||||
name = get_identifier (code->ext.omp_name);
|
||||
stmt = gfc_trans_code (code->block->next);
|
||||
return build2 (OMP_CRITICAL, void_type_node, stmt, name);
|
||||
return build2_loc (input_location, OMP_CRITICAL, void_type_node, stmt, name);
|
||||
}
|
||||
|
||||
typedef struct dovar_init_d {
|
||||
|
@ -1446,7 +1446,8 @@ gfc_trans_omp_parallel (gfc_code *code)
|
|||
omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses,
|
||||
code->loc);
|
||||
stmt = gfc_trans_omp_code (code->block->next, true);
|
||||
stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses);
|
||||
stmt = build2_loc (input_location, OMP_PARALLEL, void_type_node, stmt,
|
||||
omp_clauses);
|
||||
gfc_add_expr_to_block (&block, stmt);
|
||||
return gfc_finish_block (&block);
|
||||
}
|
||||
|
@ -1486,7 +1487,8 @@ gfc_trans_omp_parallel_do (gfc_code *code)
|
|||
stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0, 0));
|
||||
else
|
||||
poplevel (0, 0, 0);
|
||||
stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses);
|
||||
stmt = build2_loc (input_location, OMP_PARALLEL, void_type_node, stmt,
|
||||
omp_clauses);
|
||||
OMP_PARALLEL_COMBINED (stmt) = 1;
|
||||
gfc_add_expr_to_block (&block, stmt);
|
||||
return gfc_finish_block (&block);
|
||||
|
@ -1511,7 +1513,8 @@ gfc_trans_omp_parallel_sections (gfc_code *code)
|
|||
stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0, 0));
|
||||
else
|
||||
poplevel (0, 0, 0);
|
||||
stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses);
|
||||
stmt = build2_loc (input_location, OMP_PARALLEL, void_type_node, stmt,
|
||||
omp_clauses);
|
||||
OMP_PARALLEL_COMBINED (stmt) = 1;
|
||||
gfc_add_expr_to_block (&block, stmt);
|
||||
return gfc_finish_block (&block);
|
||||
|
@ -1536,7 +1539,8 @@ gfc_trans_omp_parallel_workshare (gfc_code *code)
|
|||
stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0, 0));
|
||||
else
|
||||
poplevel (0, 0, 0);
|
||||
stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses);
|
||||
stmt = build2_loc (input_location, OMP_PARALLEL, void_type_node, stmt,
|
||||
omp_clauses);
|
||||
OMP_PARALLEL_COMBINED (stmt) = 1;
|
||||
gfc_add_expr_to_block (&block, stmt);
|
||||
return gfc_finish_block (&block);
|
||||
|
@ -1568,7 +1572,8 @@ gfc_trans_omp_sections (gfc_code *code, gfc_omp_clauses *clauses)
|
|||
}
|
||||
stmt = gfc_finish_block (&body);
|
||||
|
||||
stmt = build2 (OMP_SECTIONS, void_type_node, stmt, omp_clauses);
|
||||
stmt = build2_loc (input_location, OMP_SECTIONS, void_type_node, stmt,
|
||||
omp_clauses);
|
||||
gfc_add_expr_to_block (&block, stmt);
|
||||
|
||||
return gfc_finish_block (&block);
|
||||
|
@ -1579,7 +1584,8 @@ gfc_trans_omp_single (gfc_code *code, gfc_omp_clauses *clauses)
|
|||
{
|
||||
tree omp_clauses = gfc_trans_omp_clauses (NULL, clauses, code->loc);
|
||||
tree stmt = gfc_trans_omp_code (code->block->next, true);
|
||||
stmt = build2 (OMP_SINGLE, void_type_node, stmt, omp_clauses);
|
||||
stmt = build2_loc (input_location, OMP_SINGLE, void_type_node, stmt,
|
||||
omp_clauses);
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
@ -1593,7 +1599,8 @@ gfc_trans_omp_task (gfc_code *code)
|
|||
omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses,
|
||||
code->loc);
|
||||
stmt = gfc_trans_omp_code (code->block->next, true);
|
||||
stmt = build2 (OMP_TASK, void_type_node, stmt, omp_clauses);
|
||||
stmt = build2_loc (input_location, OMP_TASK, void_type_node, stmt,
|
||||
omp_clauses);
|
||||
gfc_add_expr_to_block (&block, stmt);
|
||||
return gfc_finish_block (&block);
|
||||
}
|
||||
|
@ -1708,7 +1715,8 @@ gfc_trans_omp_workshare (gfc_code *code, gfc_omp_clauses *clauses)
|
|||
{
|
||||
/* Finish single block and add it to pblock. */
|
||||
tmp = gfc_finish_block (&singleblock);
|
||||
tmp = build2 (OMP_SINGLE, void_type_node, tmp, NULL_TREE);
|
||||
tmp = build2_loc (input_location, OMP_SINGLE,
|
||||
void_type_node, tmp, NULL_TREE);
|
||||
gfc_add_expr_to_block (pblock, tmp);
|
||||
/* Add current gfc_code to pblock. */
|
||||
gfc_add_expr_to_block (pblock, res);
|
||||
|
@ -1737,10 +1745,10 @@ gfc_trans_omp_workshare (gfc_code *code, gfc_omp_clauses *clauses)
|
|||
{
|
||||
/* Finish single block and add it to pblock. */
|
||||
tmp = gfc_finish_block (&singleblock);
|
||||
tmp = build2 (OMP_SINGLE, void_type_node, tmp,
|
||||
clauses->nowait
|
||||
? build_omp_clause (input_location, OMP_CLAUSE_NOWAIT)
|
||||
: NULL_TREE);
|
||||
tmp = build2_loc (input_location, OMP_SINGLE, void_type_node, tmp,
|
||||
clauses->nowait
|
||||
? build_omp_clause (input_location, OMP_CLAUSE_NOWAIT)
|
||||
: NULL_TREE);
|
||||
gfc_add_expr_to_block (pblock, tmp);
|
||||
}
|
||||
|
||||
|
|
|
@ -278,8 +278,8 @@ gfc_build_addr_expr (tree type, tree t)
|
|||
tree type_domain = TYPE_DOMAIN (base_type);
|
||||
if (type_domain && TYPE_MIN_VALUE (type_domain))
|
||||
min_val = TYPE_MIN_VALUE (type_domain);
|
||||
t = fold (build4 (ARRAY_REF, TREE_TYPE (type),
|
||||
t, min_val, NULL_TREE, NULL_TREE));
|
||||
t = fold (build4_loc (input_location, ARRAY_REF, TREE_TYPE (type),
|
||||
t, min_val, NULL_TREE, NULL_TREE));
|
||||
natural_type = type;
|
||||
}
|
||||
else
|
||||
|
@ -347,7 +347,8 @@ gfc_build_array_ref (tree base, tree offset, tree decl)
|
|||
}
|
||||
else
|
||||
/* Otherwise use a straightforward array reference. */
|
||||
return build4 (ARRAY_REF, type, base, offset, NULL_TREE, NULL_TREE);
|
||||
return build4_loc (input_location, ARRAY_REF, type, base, offset,
|
||||
NULL_TREE, NULL_TREE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1476,7 +1477,8 @@ gfc_finish_wrapped_block (gfc_wrapped_block* block)
|
|||
result = block->init;
|
||||
add_expr_to_chain (&result, block->code, false);
|
||||
if (block->cleanup)
|
||||
result = build2 (TRY_FINALLY_EXPR, void_type_node, result, block->cleanup);
|
||||
result = build2_loc (input_location, TRY_FINALLY_EXPR, void_type_node,
|
||||
result, block->cleanup);
|
||||
|
||||
/* Clear the block. */
|
||||
block->init = NULL_TREE;
|
||||
|
|
|
@ -741,14 +741,62 @@ struct GTY((variable_size)) lang_decl {
|
|||
#define GFC_TYPE_ARRAY_BASE_DECL(node, internal) \
|
||||
(TYPE_LANG_SPECIFIC(node)->base_decl[(internal)])
|
||||
|
||||
|
||||
/* Create _loc version of build[0-9]. */
|
||||
|
||||
static inline tree
|
||||
build1_stat_loc (location_t loc, enum tree_code code, tree type,
|
||||
tree op MEM_STAT_DECL)
|
||||
{
|
||||
tree t = build1_stat (code, type, op PASS_MEM_STAT);
|
||||
SET_EXPR_LOCATION (t, loc);
|
||||
return t;
|
||||
}
|
||||
#define build1_loc(l,c,t1,t2) build1_stat_loc (l,c,t1,t2 MEM_STAT_INFO)
|
||||
|
||||
static inline tree
|
||||
build2_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0,
|
||||
tree op MEM_STAT_DECL)
|
||||
{
|
||||
tree t = build2_stat (code, type, arg0, op PASS_MEM_STAT);
|
||||
SET_EXPR_LOCATION (t, loc);
|
||||
return t;
|
||||
}
|
||||
#define build2_loc(l,c,t1,t2,t3) build2_stat_loc (l,c,t1,t2,t3 MEM_STAT_INFO)
|
||||
|
||||
static inline tree
|
||||
build3_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0,
|
||||
tree arg1, tree op MEM_STAT_DECL)
|
||||
{
|
||||
tree t = build3_stat (code, type, arg0, arg1, op PASS_MEM_STAT);
|
||||
SET_EXPR_LOCATION (t, loc);
|
||||
return t;
|
||||
}
|
||||
#define build3_loc(l,c,t1,t2,t3,t4) \
|
||||
build3_stat_loc (l,c,t1,t2,t3,t4 MEM_STAT_INFO)
|
||||
|
||||
static inline tree
|
||||
build4_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0,
|
||||
tree arg1, tree arg2, tree op MEM_STAT_DECL)
|
||||
{
|
||||
tree t = build4_stat (code, type, arg0, arg1, arg2, op PASS_MEM_STAT);
|
||||
SET_EXPR_LOCATION (t, loc);
|
||||
return t;
|
||||
}
|
||||
#define build4_loc(l,c,t1,t2,t3,t4,t5) \
|
||||
build4_stat_loc (l,c,t1,t2,t3,t4,t5 MEM_STAT_INFO)
|
||||
|
||||
|
||||
/* Build an expression with void type. */
|
||||
#define build1_v(code, arg) fold_build1(code, void_type_node, arg)
|
||||
#define build2_v(code, arg1, arg2) fold_build2(code, void_type_node, \
|
||||
arg1, arg2)
|
||||
#define build3_v(code, arg1, arg2, arg3) fold_build3(code, void_type_node, \
|
||||
arg1, arg2, arg3)
|
||||
#define build4_v(code, arg1, arg2, arg3, arg4) build4(code, void_type_node, \
|
||||
arg1, arg2, arg3, arg4)
|
||||
#define build1_v(code, arg) \
|
||||
fold_build1_loc (input_location, code, void_type_node, arg)
|
||||
#define build2_v(code, arg1, arg2) \
|
||||
fold_build2_loc (input_location, code, void_type_node, arg1, arg2)
|
||||
#define build3_v(code, arg1, arg2, arg3) \
|
||||
fold_build3_loc (input_location, code, void_type_node, arg1, arg2, arg3)
|
||||
#define build4_v(code, arg1, arg2, arg3, arg4) \
|
||||
build4_loc (input_location, code, void_type_node, arg1, arg2, \
|
||||
arg3, arg4)
|
||||
|
||||
/* This group of functions allows a caller to evaluate an expression from
|
||||
the callee's interface. It establishes a mapping between the interface's
|
||||
|
|
Loading…
Reference in New Issue