[Bug fortran/41978] New: ICE in gfc_conv_expr_descriptor for array PPC assignment

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

[Bug fortran/41978] New: ICE in gfc_conv_expr_descriptor for array PPC assignment

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The following code ICEs:

MODULE m
  IMPLICIT NONE

  TYPE t
    PROCEDURE(myproc), POINTER, PASS :: myproc
  END TYPE t

CONTAINS

  INTEGER FUNCTION myproc (me)
    CLASS(t), INTENT(IN) :: me
    myproc = 42
  END FUNCTION myproc

END MODULE m

PROGRAM main
  USE m
  IMPLICIT NONE

  TYPE(t) :: arr(2)
  arr%myproc => myproc
END PROGRAM main

Removing the line at the bottom assigning myproc to arr%myproc makes it
compile.  The relevant error is:

[/tmp]# gfortran-dev reduced.f90
reduced.f90: In function 'MAIN__':
reduced.f90:17:0: internal compiler error: in gfc_conv_expr_descriptor, at
fortran/trans-array.c:5019
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


--
           Summary: ICE in gfc_conv_expr_descriptor for array PPC assignment
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: domob at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41978


[Bug fortran/41978] ICE in gfc_conv_expr_descriptor for array PPC assignment

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #1 from janus at gcc dot gnu dot org  2009-11-11 20:38 -------
Replacing the PPC assignment by a plain pointer component assignment

  IMPLICIT NONE
  TYPE t
    integer, pointer :: p
  END TYPE t
  integer :: i
  TYPE(t) :: arr(2)
  arr%p => i
END

is being rejected with:

  arr%p => i
  1
Error: Component to the right of a part reference with nonzero rank must not
have the POINTER attribute at (1)

This is C614 in the F03 standard:

C614 (R612) There shall not be more than one part-ref with nonzero rank. A
part-name to the right of a part-ref with nonzero rank shall not have the
ALLOCATABLE or POINTER attribute.

I'm not 100% sure, but I think this also applies to PPCs.


--


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41978


[Bug fortran/41978] [F03] ICE in gfc_conv_expr_descriptor for array PPC assignment

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #2 from janus at gcc dot gnu dot org  2009-11-11 21:02 -------
(In reply to comment #1)
> I'm not 100% sure, but I think this also applies to PPCs.

If this is correct, then the fix for this PR is as simple as

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (revision 153965)
+++ gcc/fortran/resolve.c       (working copy)
@@ -4272,7 +4272,8 @@ resolve_ref (gfc_expr *expr)
        case REF_COMPONENT:
          if (current_part_dimension || seen_part_dimension)
            {
-             if (ref->u.c.component->attr.pointer)
+             if (ref->u.c.component->attr.pointer
+                 || ref->u.c.component->attr.proc_pointer)
                {
                  gfc_error ("Component to the right of a part reference "
                             "with nonzero rank must not have the POINTER "

Daniel, what do you think?


--

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |janus at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-11-11 21:02:50
               date|                            |
            Summary|ICE in                      |[F03] ICE in
                   |gfc_conv_expr_descriptor for|gfc_conv_expr_descriptor for
                   |array PPC assignment        |array PPC assignment


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41978


[Bug fortran/41978] [F03] ICE in gfc_conv_expr_descriptor for array PPC assignment

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #3 from domob at gcc dot gnu dot org  2009-11-11 21:08 -------
I've not checked the standard about this, but seems fine to me.  I also give
you an ok for that patch (maybe with a test-case) if you want to submit/commit.


--


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41978


[Bug fortran/41978] [F03] ICE in gfc_conv_expr_descriptor for array PPC assignment

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #4 from janus at gcc dot gnu dot org  2009-11-11 22:37 -------
Subject: Bug 41978

Author: janus
Date: Wed Nov 11 22:37:31 2009
New Revision: 154107

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154107
Log:
2009-11-11  Janus Weil  <janus@...>

        PR fortran/41978
        * resolve.c (resolve_ref): Take care of procedure pointer component
        references.


2009-11-11  Janus Weil  <janus@...>

        PR fortran/41978
        * gfortran.dg/proc_ptr_comp_22.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_22.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


--


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41978


[Bug fortran/41978] [F03] ICE in gfc_conv_expr_descriptor for array PPC assignment

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #5 from janus at gcc dot gnu dot org  2009-11-11 22:38 -------
Fixed with r154107. Closing.


--

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41978