------- Comment #3 from mikael at gcc dot gnu dot org  2010-04-10 21:27 -------
With this :
diff --git a/trans-expr.c b/trans-expr.c
index 7e95ce1..a6f8616 100644
--- a/trans-expr.c
+++ b/trans-expr.c
@@ -1382,6 +1382,8 @@ gfc_conv_expr_op (gfc_se * se, gfc_expr * expr)
   else
     se->expr = fold_build2 (code, type, lse.expr, rse.expr);

+  SET_EXPR_LOCATION (se->expr, expr->where.lb->location);
+
   /* Add the post blocks.  */
   gfc_add_block_to_block (&se->post, &rse.post);
   gfc_add_block_to_block (&se->post, &lse.post);
diff --git a/trans-stmt.c b/trans-stmt.c
index 0b215f2..4b8ae69 100644
--- a/trans-stmt.c
+++ b/trans-stmt.c
@@ -718,6 +718,7 @@ gfc_trans_if_1 (gfc_code * code)

   /* Build the condition expression and add it to the condition block.  */
   stmt = fold_build3 (COND_EXPR, void_type_node, if_se.expr, stmt, elsestmt);
+  SET_EXPR_LOCATION (stmt, code->loc.lb->location);

   gfc_add_expr_to_block (&if_se.pre, stmt);



I get :
        -:    0:Source:pr41359.f90
        -:    0:Graph:pr41359.gcno
        -:    0:Data:pr41359.gcda
        -:    0:Runs:1
        -:    0:Programs:1
        1:    1:program main
        -:    2:
        -:    3:   implicit none
        -:    4:
        -:    5:   integer :: a = 7
        -:    6:
        1:    7:   if( a == 0 ) then
    #####:    8:      print *, "a is null"
        1:    9:   else if( a > 0 ) then
        1:   10:      print *, "a is positif"
        -:   11:   else
    #####:   12:      print *, "a is negatif"
        -:   13:   end if
        -:   14:
        2:   15:end program
        -:   16:


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41359

Reply via email to