This program gives an "Internal Error" pointing at the CONTAINS: INTEGER FUNCTION test () CONTAINS END FUNCTION test It works with gfortran 4.3.1. Replacing the FUNCTION by a SUBROUTINE gets rid of the error. Additionally, this program also works: FUNCTION test () INTEGER :: test CONTAINS END FUNCTION test
confirm quickfix: Index: parse.c =================================================================== --- parse.c (révision 142172) +++ parse.c (copie de travail) @@ -2323,7 +2323,7 @@ parse_spec (gfc_statement st) gfc_symbol* proc = gfc_current_ns->proc_name; gcc_assert (proc); - if (proc->result->ts.type == BT_UNKNOWN) + if (proc->result->ts.type != BT_UNKNOWN) function_result_typed = true; } @@ -2333,7 +2333,7 @@ loop: (and thus we can expect to see none any further), type the function result if it has not yet been typed. Be careful not to give the END statement to verify_st_order! */ - if (!function_result_typed && st != ST_GET_FCN_CHARACTERISTICS) + if (!function_result_typed && st == ST_GET_FCN_CHARACTERISTICS) { bool verify_now = false; I'm probably missing something
(In reply to comment #1) > I'm probably missing something > Indeed I was. :'( FAIL: gfortran.dg/actual_array_result_1.f90
(In reply to comment #2) I am on my travels right now and only have 4.4.0 20080624 on my laptop. The testcase works fine with that, so this regression has crept in since then. Cheers Paul
(In reply to comment #3) > (In reply to comment #2) > > I am on my travels right now and only have 4.4.0 20080624 on my laptop. The > testcase works fine with that, so this regression has crept in since then. ...or it is some changes on my tree I forgot to cleanup. Did you manage to apply the patch without this? http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139425 I will investigate more next week-end (unless someone beats me ;-))
(In reply to comment #4) > I will investigate more next week-end (unless someone beats me ;-)) > I'm investigating now. The first patch was probably wrong. I'm testing this one at the moment: Index: parse.c =================================================================== --- parse.c (r�vision 142242) +++ parse.c (copie de travail) @@ -1576,7 +1576,7 @@ typedef struct { enum { ORDER_START, ORDER_USE, ORDER_IMPORT, ORDER_IMPLICIT_NONE, - ORDER_IMPLICIT, ORDER_SPEC, ORDER_EXEC + ORDER_IMPLICIT, ORDER_SPEC, ORDER_EXEC, ORDER_CONTAINS } state; gfc_statement last_statement; @@ -1658,6 +1658,10 @@ verify_st_order (st_state *p, gfc_statement st, bo p->state = ORDER_EXEC; break; + case ST_CONTAINS: + p->state = ORDER_CONTAINS; + break; + default: gfc_internal_error ("Unexpected %s statement in verify_st_order() at %C", gfc_ascii_statement (st));
Subject: Bug 38252 Author: mikael Date: Mon Dec 1 19:30:55 2008 New Revision: 142327 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142327 Log: 2008-12-01 Mikael Morin <mikael.morin@tele2.fr> PR fortran/38252 * parse.c (parse_spec): Skip statement order check in case of a CONTAINS statement. 2008-12-01 Mikael Morin <mikael.morin@tele2.fr> PR fortran/38252 * gfortran.dg/empty_function_1.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/empty_function_1.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/parse.c trunk/gcc/testsuite/ChangeLog
I hope one day I'll be able to commit properly.
Subject: Bug 38252 Author: mikael Date: Mon Dec 1 19:52:15 2008 New Revision: 142331 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142331 Log: 2008-12-01 Mikael Morin <mikael.morin@tele2.fr> PR fortran/38252 * gfortran.dg/empty_function_1.f90: Fix latest commit. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/empty_function_1.f90
Fixed on trunk. Let's not forget to close.