[patch, fortran] PR41909 [4.4/4.5 Regression] ICE with "call foo" in "program foo"

View: New views
3 Messages — Rating Filter:   Alert me  

[patch, fortran] PR41909 [4.4/4.5 Regression] ICE with "call foo" in "program foo"

by Jerry DeLisle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Folks,

This simple patch avoids the assertion that is giving the ICE.

Regression tested on x86-64.

With the patch, the test case in the PR gives:

$ gfc pr41909.f90
pr41909.f90:3.13:

   call test()
              1
pr41909.f90:1.12:

program test
             2
Error: Global name 'test' at (1) is already being used as a PROGRAM at (2)


OK for trunk?

Regards,

Jerry

Index: resolve.c
===================================================================
--- resolve.c (revision 153956)
+++ resolve.c (working copy)
@@ -1117,6 +1117,9 @@
    gfc_symbol* context_proc;
    gfc_namespace* real_context;

+  if (sym->attr.flavor == FL_PROGRAM)
+    return false;
+
    gcc_assert (sym->attr.flavor == FL_PROCEDURE);

    /* If we've got an ENTRY, find real procedure.  */

Re: [patch, fortran] PR41909 [4.4/4.5 Regression] ICE with "call foo" in "program foo"

by Janne Blomqvist-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jerry DeLisle wrote:

> Hi Folks,
>
> This simple patch avoids the assertion that is giving the ICE.
>
> Regression tested on x86-64.
>
> With the patch, the test case in the PR gives:
>
> $ gfc pr41909.f90
> pr41909.f90:3.13:
>
>   call test()
>              1
> pr41909.f90:1.12:
>
> program test
>             2
> Error: Global name 'test' at (1) is already being used as a PROGRAM at (2)
>
>
> OK for trunk?

Ok, provided you also commit a changelog entry and a testcase for the
testsuite.

Does the same patch also apply to 4.4 and gets rid of the ICE? It seems
a backport is in order.


--
Janne Blomqvist

Re: [patch, fortran] PR41909 [4.4/4.5 Regression] ICE with "call foo" in "program foo"

by Jerry DeLisle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11/06/2009 12:34 AM, Janne Blomqvist wrote:

> Jerry DeLisle wrote:
>> Hi Folks,
>>
>> This simple patch avoids the assertion that is giving the ICE.
>>
>> Regression tested on x86-64.
>>
>> With the patch, the test case in the PR gives:
>>
>> $ gfc pr41909.f90
>> pr41909.f90:3.13:
>>
>> call test()
>> 1
>> pr41909.f90:1.12:
>>
>> program test
>> 2
>> Error: Global name 'test' at (1) is already being used as a PROGRAM at
>> (2)
>>
>>
>> OK for trunk?
>
> Ok, provided you also commit a changelog entry and a testcase for the
> testsuite.
>
> Does the same patch also apply to 4.4 and gets rid of the ICE? It seems
> a backport is in order.
>
>
Yes I will do a ChangeLog and test case.  I will check 4.4 and see what happens.

Jerry