diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2019-12-07 11:07:07 +0000 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2019-12-07 12:07:07 +0100 |
commit | 9c81750c5bedd7883182ee2684a012c6210ebe1d (patch) | |
tree | a3355f687262d05caae19a9ab28b2fba2c9745ac /gcc/fortran/trans-stmt.c | |
parent | b01d215df18ba753746a170125b883befe100d67 (diff) | |
download | gcc-9c81750c5bedd7883182ee2684a012c6210ebe1d.zip gcc-9c81750c5bedd7883182ee2684a012c6210ebe1d.tar.gz gcc-9c81750c5bedd7883182ee2684a012c6210ebe1d.tar.bz2 |
Fortran] PR 92793 - fix column used for error diagnostic
PR fortran/92793
* trans.c (gfc_get_location): Declare.
* trans.c (gfc_get_location): Define; returns column-corrected location.
(trans_runtime_error_vararg, gfc_trans_runtime_check,
gfc_generate_module_code): Use new function.
* trans-array.c (gfc_trans_auto_array_allocation): Likewise.
* trans-common.c (build_field, get_init_field, create_common): Likewise.
* trans-decl.c (gfc_build_label_decl, gfc_get_symbol_decl): Likewise.
* trans-openmp.c (gfc_trans_omp_reduction_list, gfc_trans_omp_clauses):
Likewise.
* trans-stmt.c (gfc_trans_if_1): Likewise.
From-SVN: r279075
Diffstat (limited to 'gcc/fortran/trans-stmt.c')
-rw-r--r-- | gcc/fortran/trans-stmt.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index bce353e..3275cb4 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -1454,7 +1454,8 @@ gfc_trans_if_1 (gfc_code * code) elsestmt = build_empty_stmt (input_location); /* Build the condition expression and add it to the condition block. */ - loc = code->expr1->where.lb ? code->expr1->where.lb->location : input_location; + loc = code->expr1->where.lb ? gfc_get_location (&code->expr1->where) + : input_location; stmt = fold_build3_loc (loc, COND_EXPR, void_type_node, if_se.expr, stmt, elsestmt); @@ -2328,7 +2329,7 @@ gfc_trans_simple_do (gfc_code * code, stmtblock_t *pblock, tree dovar, type = TREE_TYPE (dovar); bool is_step_positive = tree_int_cst_sgn (step) > 0; - loc = code->ext.iterator->start->where.lb->location; + loc = gfc_get_location (&code->ext.iterator->start->where); /* Initialize the DO variable: dovar = from. */ gfc_add_modify_loc (loc, pblock, dovar, @@ -2507,7 +2508,7 @@ gfc_trans_do (gfc_code * code, tree exit_cond) gfc_start_block (&block); - loc = code->ext.iterator->start->where.lb->location; + loc = gfc_get_location (&code->ext.iterator->start->where); /* Evaluate all the expressions in the iterator. */ gfc_init_se (&se, NULL); @@ -2801,15 +2802,17 @@ gfc_trans_do_while (gfc_code * code) gfc_init_se (&cond, NULL); gfc_conv_expr_val (&cond, code->expr1); gfc_add_block_to_block (&block, &cond.pre); - cond.expr = fold_build1_loc (code->expr1->where.lb->location, - TRUTH_NOT_EXPR, TREE_TYPE (cond.expr), cond.expr); + cond.expr = fold_build1_loc (gfc_get_location (&code->expr1->where), + TRUTH_NOT_EXPR, TREE_TYPE (cond.expr), + cond.expr); /* Build "IF (! cond) GOTO exit_label". */ tmp = build1_v (GOTO_EXPR, exit_label); TREE_USED (exit_label) = 1; - tmp = fold_build3_loc (code->expr1->where.lb->location, COND_EXPR, + tmp = fold_build3_loc (gfc_get_location (&code->expr1->where), COND_EXPR, void_type_node, cond.expr, tmp, - build_empty_stmt (code->expr1->where.lb->location)); + build_empty_stmt (gfc_get_location ( + &code->expr1->where))); gfc_add_expr_to_block (&block, tmp); /* The main body of the loop. */ @@ -2828,7 +2831,7 @@ gfc_trans_do_while (gfc_code * code) gfc_init_block (&block); /* Build the loop. */ - tmp = fold_build1_loc (code->expr1->where.lb->location, LOOP_EXPR, + tmp = fold_build1_loc (gfc_get_location (&code->expr1->where), LOOP_EXPR, void_type_node, tmp); gfc_add_expr_to_block (&block, tmp); |