On Linux/ia32, revision 162776: http://gcc.gnu.org/ml/gcc-cvs/2010-07/msg01130.html caused: FAIL: gfortran.dg/abstract_type_6.f03 -O (internal compiler error) FAIL: gfortran.dg/abstract_type_6.f03 -O (test for excess errors) FAIL: gfortran.dg/bind_c_dts_3.f03 -O (internal compiler error) FAIL: gfortran.dg/bind_c_dts_3.f03 -O (test for excess errors) FAIL: gfortran.dg/c_assoc_2.f03 -O (internal compiler error) FAIL: gfortran.dg/c_assoc_2.f03 -O (test for excess errors) FAIL: gfortran.dg/c_ptr_tests_5.f03 -O (internal compiler error) FAIL: gfortran.dg/c_ptr_tests_5.f03 -O (test for excess errors) FAIL: gfortran.dg/finalize_3.f03 -O (internal compiler error) FAIL: gfortran.dg/finalize_3.f03 -O (test for excess errors) FAIL: gfortran.dg/function_kinds_5.f90 -O (internal compiler error) FAIL: gfortran.dg/function_kinds_5.f90 -O (test for excess errors) FAIL: gfortran.dg/proc_decl_3.f90 -O (internal compiler error) FAIL: gfortran.dg/proc_decl_3.f90 -O (test for excess errors) FAIL: gfortran.dg/proc_ptr_comp_pass_4.f90 -O (internal compiler error) FAIL: gfortran.dg/proc_ptr_comp_pass_4.f90 -O (test for excess errors) FAIL: gfortran.dg/proc_ptr_result_2.f90 -O (internal compiler error) FAIL: gfortran.dg/proc_ptr_result_2.f90 -O (test for excess errors) FAIL: gfortran.dg/typebound_call_15.f03 -O (internal compiler error) FAIL: gfortran.dg/typebound_call_15.f03 -O (test for excess errors) FAIL: gfortran.dg/typebound_call_4.f03 -O (internal compiler error) FAIL: gfortran.dg/typebound_call_4.f03 -O (test for excess errors) FAIL: gfortran.dg/typebound_operator_2.f03 -O (internal compiler error) FAIL: gfortran.dg/typebound_operator_2.f03 -O (test for excess errors) FAIL: gfortran.dg/typebound_proc_13.f03 -O (internal compiler error) FAIL: gfortran.dg/typebound_proc_13.f03 -O (test for excess errors) FAIL: gfortran.dg/typebound_proc_15.f03 -O (internal compiler error) FAIL: gfortran.dg/typebound_proc_15.f03 -O (test for excess errors) FAIL: gfortran.dg/typebound_proc_5.f03 -O (test for errors, line 109) FAIL: gfortran.dg/typebound_proc_5.f03 -O (internal compiler error) FAIL: gfortran.dg/typebound_proc_5.f03 -O (test for excess errors) FAIL: gfortran.dg/typebound_proc_6.f03 -O (internal compiler error) FAIL: gfortran.dg/typebound_proc_6.f03 -O (test for excess errors)
Likely due to revision 162776: [macbook] f90/bug% gfc -std=f2003 /opt/gcc/work/gcc/testsuite/gfortran.dg/typebound_proc_15.f03 /opt/gcc/work/gcc/testsuite/gfortran.dg/typebound_proc_15.f03:15.23: procedure :: bar, baz ! { dg-error "PROCEDURE list" } 1 Error: Fortran 2008: PROCEDURE list at (1) f951: internal compiler error: in next_statement, at fortran/parse.c:894
Confirmed, and mine I guess. I don't know what I was testing when I said I was testing the patch for the future revision 162776. Actually, I was a bit surprised not to see any failure in the testsuite. Anyway, the patch is OK, I think (It can be reverted temporarily if needed). I will look at the failures.
Many of these failures are actually due to 'gfc_copy_formal_args' and can be fixed with: Index: gcc/fortran/symbol.c =================================================================== --- gcc/fortran/symbol.c (revision 162794) +++ gcc/fortran/symbol.c (working copy) @@ -4030,6 +4030,9 @@ gfc_copy_formal_args (gfc_symbol *dest, gfc_symbol gfc_formal_arglist *formal_prev = NULL; /* Save current namespace so we can change it for formal args. */ gfc_namespace *parent_ns = gfc_current_ns; + + if (!src->formal) + return; /* Create a new namespace, which will be the formal ns (namespace of the formal args). */ @@ -4070,6 +4073,8 @@ gfc_copy_formal_args (gfc_symbol *dest, gfc_symbol dest->formal_ns = gfc_current_ns; /* Restore the current namespace to what it was on entry. */ gfc_current_ns = parent_ns; + + gfc_commit_symbols (); } @@ -4181,6 +4186,8 @@ gfc_copy_formal_args_ppc (gfc_component *dest, gfc dest->formal_ns = gfc_current_ns; /* Restore the current namespace to what it was on entry. */ gfc_current_ns = parent_ns; + + gfc_commit_symbols (); } With this patch, the remaining failures are: FAIL: gfortran.dg/bind_c_dts_3.f03 -O (internal compiler error) FAIL: gfortran.dg/c_assoc_2.f03 -O (internal compiler error) FAIL: gfortran.dg/c_ptr_tests_5.f03 -O (internal compiler error) FAIL: gfortran.dg/finalize_3.f03 -O (internal compiler error) FAIL: gfortran.dg/function_kinds_5.f90 -O (internal compiler error) FAIL: gfortran.dg/proc_ptr_result_2.f90 -O (internal compiler error)
Btw, maybe 'changed_syms' should be made static again. Instead of the assert in parse.c one can use 'gfc_symbol_state'.
(In reply to comment #3) > Many of these failures are actually due to 'gfc_copy_formal_args' and can be > fixed with: [...] > > Agreed. The patch I was about to post had also this extra hunk : Index: symbol.c =================================================================== --- symbol.c (revision 162798) +++ symbol.c (working copy) @@ -4141,6 +4141,10 @@ gfc_copy_formal_args_ppc (gfc_component *dest, gfc /* Save current namespace so we can change it for formal args. */ gfc_namespace *parent_ns = gfc_current_ns; + /* Make sure gfc_commit_symbols at the end doesn't commit something + unrelated. */ + gcc_assert (changed_syms == NULL); + /* Create a new namespace, which will be the formal ns (namespace of the formal args). */ gfc_current_ns = gfc_get_namespace (parent_ns, 0);
(In reply to comment #4) > Btw, maybe 'changed_syms' should be made static again. Instead of the assert in > parse.c one can use 'gfc_symbol_state'. > Yes, makes sense.
(In reply to comment #3) > With this patch, the remaining failures are: > > FAIL: gfortran.dg/bind_c_dts_3.f03 -O (internal compiler error) > FAIL: gfortran.dg/c_assoc_2.f03 -O (internal compiler error) fixed by this : Index: intrinsic.c =================================================================== --- intrinsic.c (revision 162798) +++ intrinsic.c (working copy) @@ -112,6 +112,8 @@ gfc_get_intrinsic_sub_symbol (const char *name) sym->attr.flavor = FL_PROCEDURE; sym->attr.proc = PROC_INTRINSIC; + gfc_commit_symbols (); + return sym; } Remaining : > FAIL: gfortran.dg/c_ptr_tests_5.f03 -O (internal compiler error) > FAIL: gfortran.dg/finalize_3.f03 -O (internal compiler error) > FAIL: gfortran.dg/function_kinds_5.f90 -O (internal compiler error) > FAIL: gfortran.dg/proc_ptr_result_2.f90 -O (internal compiler error) >
> > FAIL: gfortran.dg/proc_ptr_result_2.f90 -O (internal compiler error) This one is fixed by adding a 'gfc_commit_symbols' also in 'gfc_copy_formal_args_intr' (cf. comment #3). Still Remaining : > > FAIL: gfortran.dg/c_ptr_tests_5.f03 -O (internal compiler error) > > FAIL: gfortran.dg/finalize_3.f03 -O (internal compiler error) > > FAIL: gfortran.dg/function_kinds_5.f90 -O (internal compiler error)
Created attachment 21367 [details] Tentative patch I will test & submit this tomorrow. I have decided to use gfc_commit_symbol (sym) instead of the full gfc_commit_symbols to minimize interference with changed_sym in both parsing mode and resolution mode (just in case someone wants to use the functions in the other mode in the future). The remaining testcases were missing a reject_statement () or gfc_undo_symbol thrown together with the error. The patch also corrects others cases in the affected functions that may prove wrong in the future.
The patch in comment #9 works as expected on the gfortran testsuite and on my own tests. Note that while testing I have found unrelated pr45161. Thanks for the patch.
Subject: Bug 45151 Author: mikael Date: Mon Aug 2 15:30:47 2010 New Revision: 162821 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162821 Log: 2010-08-02 Mikael Morin <mikael@gcc.gnu.org> Janus Weil <janus@gcc.gnu.org> PR fortran/42051 PR fortran/44064 PR fortran/45151 * intrinsic.c (gfc_get_intrinsic_sub_symbol): Commit changed symbol. * symbol.c (gen_cptr_param, gen_fptr_param, gen_shape_param, gfc_copy_formal_args, gfc_copy_formal_args_intr, gfc_copy_formal_args_ppc, generate_isocbinding_symbol): Ditto. * parse.c (parse_derived_contains, parse_spec, parse_progunit): Call reject_statement in case of error. (match_deferred_characteritics): Call gfc_undo_symbols in case match fails. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/intrinsic.c trunk/gcc/fortran/parse.c trunk/gcc/fortran/symbol.c
This PR seems to be mostly fixed: - x86_64-unknown-linux-gnu shows _no_ failures (-m32/-m64) http://gcc.gnu.org/ml/gcc-testresults/2010-08/msg00217.html - ia64-unknown-linux-gnu shows _two_ failures: http://gcc.gnu.org/ml/gcc-testresults/2010-08/msg00213.html FAIL: gfortran.dg/maxlocval_3.f90 -O3 -fomit-frame-pointer -funroll-loops (test for excess errors) FAIL: gfortran.dg/maxlocval_3.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions (test for excess errors) FAIL: gfortran.dg/typebound_proc_15.f03 -O (internal compiler error) FAIL: gfortran.dg/typebound_proc_15.f03 -O (test for excess errors) The latter is PR 44584 for which a patch has just been posted. HJ: Can you confirm that all failures are now gone (pending the PR 44584 committal), except for maxlocval_3.f90? Can you post the excess error which is shown for maxlocval_3.f90?
gfortran.dg/maxlocval_3.f90 is due to assembler warning: /tmp/cc9gn3uW.s:3475: Warning: Use of 'movl' may violate WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 24^M /tmp/cc9gn3uW.s:3475: Warning: Only the first path encountering the conflict is reported^M /tmp/cc9gn3uW.s:3472: Warning: This is the location of the conflicting usage^M output is: /tmp/cc9gn3uW.s: Assembler messages:^M /tmp/cc9gn3uW.s:3475: Warning: Use of 'movl' may violate WAW dependency 'GR%, % in 1 - 127' (impliedf), specific resource number is 24^M /tmp/cc9gn3uW.s:3475: Warning: Only the first path encountering the conflict is reported^M /tmp/cc9gn3uW.s:3472: Warning: This is the location of the conflicting usage^M FAIL: gfortran.dg/maxlocval_3.f90 -O3 -fomit-frame-pointer -funroll-loops (test for excess errors)
The assembler warning messages (shown in comment #13) that are causing the failure of gfortran.dg/maxlocval_3.f90 are due to PR 15445 and is not a new problem.
Based on the comments: Close as FIXED. Thanks for the initial report HJ; thanks for the fix Mikael; and thanks for the pointer to PR target/15445 Steve!
Subject: Bug 45151 Author: mikael Date: Thu Aug 5 21:08:36 2010 New Revision: 162921 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162921 Log: 2010-08-05 Mikael Morin <mikael@gcc.gnu.org> Janus Weil <janus@gcc.gnu.org> PR fortran/42051 PR fortran/44064 PR fortran/45151 * intrinsic.c (gfc_get_intrinsic_sub_symbol): Commit changed symbol. * symbol.c (gen_cptr_param, gen_fptr_param, gen_shape_param, gfc_copy_formal_args, gfc_copy_formal_args_intr, gfc_copy_formal_args_ppc, generate_isocbinding_symbol): Ditto. (gfc_find_derived_vtab): Commit newly created symbols. * parse.c (parse_derived_contains, parse_spec, parse_progunit): Call reject_statement in case of error. (match_deferred_characteritics): Call gfc_undo_symbols in case match fails. Modified: branches/gcc-4_5-branch/gcc/fortran/ChangeLog branches/gcc-4_5-branch/gcc/fortran/intrinsic.c branches/gcc-4_5-branch/gcc/fortran/parse.c branches/gcc-4_5-branch/gcc/fortran/symbol.c