[Bug fortran/24545] gfortran bug regarding interface block with named END INTERFACE statements

Paul Thomas paulthomas2@wanadoo.fr
Wed Oct 26 19:20:00 GMT 2005


Steve,

You beat me too it. See below, what I wrote and was about to add to the PR!

I think that in the circumstances, if it regtests OK, I am more than 
happy for you to commit the patch to mainline and 4.0. A reduced 
testcase is obvious.

Best regards

Paul T

>On Wed, Oct 26, 2005 at 04:54:27PM +0200, Paul Thomas wrote:
>
>>Paul,
>>
>>That is indeed a bug.  Could you make a PR for it, please?
>>
>
>I have a reduce testcase, and I'll submit a PR.  The problem is
>that gfortran is apparently not happy with the "OPERATOR (.EqualTo.)"
>in "END INTERFACE OPERATOR (.EqualTo.)"
>
>
Interface.c(gfc_match_end_interface) has the wrong stuff in it:

00294     case INTERFACE_USER_OP <cid:part1.03020900.01070903@wanadoo.fr>:
00295       /* Comparing the symbol node names is OK because only use-associated
00296          symbols can be renamed.  */
00297       if (type != current_interface <cid:part2.02060807.04060507@wanadoo.fr>.type <cid:part3.05090206.02010006@wanadoo.fr>
00298           || strcmp (current_interface <cid:part2.02060807.04060507@wanadoo.fr>.sym <cid:part5.02010803.02050104@wanadoo.fr>->name <cid:part6.09060709.07050104@wanadoo.fr>, name) != 0)
00299         {
00300           gfc_error <cid:part7.02090404.07070909@wanadoo.fr> ("Expecting 'END INTERFACE OPERATOR (.%s.)' at %C",
00301                      current_interface <cid:part2.02060807.04060507@wanadoo.fr>.sym <cid:part5.02010803.02050104@wanadoo.fr>->name <cid:part6.09060709.07050104@wanadoo.fr>);
00302           m = MATCH_ERROR <cid:part11.05030603.09080200@wanadoo.fr>;
00303         }

gfc_match_interface has:

00223     case INTERFACE_USER_OP <cid:part1.03020900.01070903@wanadoo.fr>:
00224       current_interface <cid:part2.02060807.04060507@wanadoo.fr>.uop <cid:part14.02010001.05000007@wanadoo.fr> = gfc_get_uop <cid:part15.02090608.04070504@wanadoo.fr> (name);
00225       break;

and, as far as I can see, current_interface.sym never gets filled.  This is why the first error 
has the name of the previous interface and reversing the order of the interfaces causes a segfault.

We need to interchange the .sym with .uop in gfc_match_end_interface.

Paul





More information about the Fortran mailing list