At the end of gfc_trans_code one finds the following: gfc_set_backend_locus (&code->loc); if (res != NULL_TREE && ! IS_EMPTY_STMT (res)) { if (TREE_CODE (res) != STATEMENT_LIST) SET_EXPR_LOCATION (res, input_location); /* Add the new statement to the block. */ gfc_add_expr_to_block (&block, res); } } /* Return the finished block. */ return gfc_finish_block (&block); } In principle the call to SET_EXPR_LOCATION should not be needed here, since the location should already be set correctly at this point; cf. the discussion in http://gcc.gnu.org/ml/fortran/2009-10/msg00205.html and follow-ups. However, this patch Index: gcc/fortran/trans.c =================================================================== --- gcc/fortran/trans.c (Revision 153547) +++ gcc/fortran/trans.c (Arbeitskopie) @@ -1281,9 +1281,6 @@ gfc_trans_code (gfc_code * code) if (res != NULL_TREE && ! IS_EMPTY_STMT (res)) { - if (TREE_CODE (res) != STATEMENT_LIST) - SET_EXPR_LOCATION (res, input_location); - /* Add the new statement to the block. */ gfc_add_expr_to_block (&block, res); } yields (at least) the following regressions: FAIL: gfortran.dg/gomp/appendix-a/a.24.1.f90 -O (test for errors, line 20) FAIL: gfortran.dg/gomp/appendix-a/a.24.1.f90 -O (test for errors, line 14) FAIL: gfortran.dg/gomp/appendix-a/a.24.1.f90 -O (test for errors, line 20) FAIL: gfortran.dg/gomp/appendix-a/a.24.1.f90 -O (test for excess errors) FAIL: gfortran.dg/gomp/appendix-a/a.35.1.f90 -O (test for warnings, line 13) FAIL: gfortran.dg/gomp/appendix-a/a.35.1.f90 -O (test for excess errors) FAIL: gfortran.dg/gomp/appendix-a/a.35.3.f90 -O (test for warnings, line 10) FAIL: gfortran.dg/gomp/appendix-a/a.35.3.f90 -O (test for excess errors) FAIL: gfortran.dg/gomp/appendix-a/a.35.4.f90 -O (test for warnings, line 11) FAIL: gfortran.dg/gomp/appendix-a/a.35.4.f90 -O (test for excess errors) FAIL: gfortran.dg/gomp/appendix-a/a.35.6.f90 -O (test for warnings, line 9) FAIL: gfortran.dg/gomp/appendix-a/a.35.6.f90 -O (test for excess errors) FAIL: gfortran.dg/gomp/block-1.f90 -O (test for errors, line 5) FAIL: gfortran.dg/gomp/block-1.f90 -O (test for excess errors) FAIL: gfortran.dg/gomp/crayptr3.f90 -O (test for errors, line 19) FAIL: gfortran.dg/gomp/crayptr3.f90 -O (test for errors, line 20) FAIL: gfortran.dg/gomp/crayptr3.f90 -O (test for excess errors) FAIL: gfortran.dg/gomp/pr33439.f90 -O (test for errors, line 8) FAIL: gfortran.dg/gomp/pr33439.f90 -O (test for errors, line 10) FAIL: gfortran.dg/gomp/pr33439.f90 -O (test for errors, line 21) FAIL: gfortran.dg/gomp/pr33439.f90 -O (test for errors, line 22) FAIL: gfortran.dg/gomp/pr33439.f90 -O (test for errors, line 33) FAIL: gfortran.dg/gomp/pr33439.f90 -O (test for excess errors) FAIL: gfortran.dg/gomp/sharing-1.f90 -O (test for errors, line 12) FAIL: gfortran.dg/gomp/sharing-1.f90 -O (test for errors, line 24) FAIL: gfortran.dg/gomp/sharing-1.f90 -O (test for errors, line 25) FAIL: gfortran.dg/gomp/sharing-1.f90 -O (test for errors, line 26) FAIL: gfortran.dg/gomp/sharing-1.f90 -O (test for excess errors) FAIL: gfortran.dg/gomp/sharing-2.f90 -O (test for errors, line 12) FAIL: gfortran.dg/gomp/sharing-2.f90 -O (test for errors, line 16) FAIL: gfortran.dg/gomp/sharing-2.f90 -O (test for errors, line 57) FAIL: gfortran.dg/gomp/sharing-2.f90 -O (test for errors, line 58) FAIL: gfortran.dg/gomp/sharing-2.f90 -O (test for errors, line 64) FAIL: gfortran.dg/gomp/sharing-2.f90 -O (test for errors, line 65) FAIL: gfortran.dg/gomp/sharing-2.f90 -O (test for excess errors) FAIL: gfortran.dg/gomp/sharing-3.f90 -O (test for errors, line 28) FAIL: gfortran.dg/gomp/sharing-3.f90 -O (test for errors, line 30) FAIL: gfortran.dg/gomp/sharing-3.f90 -O (test for errors, line 33) FAIL: gfortran.dg/gomp/sharing-3.f90 -O (test for errors, line 34) FAIL: gfortran.dg/gomp/sharing-3.f90 -O (test for excess errors) One should find out for which kind of statements the SET_EXPR_LOCATION is actually needed, and fix those in an appropriate way.
Since all regressions are OpenMP related, the following patch works without any testsuite failures: Index: gcc/fortran/trans.c =================================================================== --- gcc/fortran/trans.c (revision 154189) +++ gcc/fortran/trans.c (working copy) @@ -1281,7 +1281,7 @@ gfc_trans_code (gfc_code * code) if (res != NULL_TREE && ! IS_EMPTY_STMT (res)) { - if (TREE_CODE (res) != STATEMENT_LIST) + if (TREE_CODE (res) != STATEMENT_LIST && gfc_option.flag_openmp) SET_EXPR_LOCATION (res, input_location); /* Add the new statement to the block. */
See PR41359 for another use of SET_EXPR_LOCATION.
Is this PR another WONTFIX?
Moving to waiting.
(In reply to Dominique d'Humieres from comment #4) > Moving to waiting. SUSPENDED would probably be better