public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/46356] New: Erroneous procedure/intent error and ICE for class dummy argument
@ 2010-11-08  4:09 ian_harvey at bigpond dot com
  2010-11-08  8:31 ` [Bug fortran/46356] [OOP] " janus at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: ian_harvey at bigpond dot com @ 2010-11-08  4:09 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Erroneous procedure/intent error and ICE for class
                    dummy argument
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ian_harvey@bigpond.com


The following example, when compiled with gfortran 4.6 built from trunk source
166232 (20101103), rejects the following code with a dubious errror (PROCEDURE
attribute conflicts with INTENT attribute in 'pvec') before the compiler dies
with an ICE.

I believe the code is valid F2003.  It, and the subsequent variations below,
are accepted by ifort 11.1.067.  

MODULE procedure_intent_nonsense
  IMPLICIT NONE  
  PRIVATE    
  TYPE, PUBLIC :: Parent
    INTEGER :: comp
  END TYPE Parent

  TYPE :: ParentVector
    INTEGER :: a
    ! CLASS(Parent), ALLOCATABLE :: a
  END TYPE ParentVector  
CONTAINS           
  SUBROUTINE vector_operation(pvec)     
    CLASS(ParentVector), INTENT(INOUT) :: pvec(:)
    INTEGER :: i    
    !---
    DO i = 1, SIZE(pvec)
      CALL item_operation(pvec(i))
    END DO  
    ! PRINT *, pvec(1)%a%comp
  END SUBROUTINE vector_operation

  SUBROUTINE item_operation(pvec)  
    CLASS(ParentVector), INTENT(INOUT) :: pvec
    !TYPE(ParentVector), INTENT(INOUT) :: pvec
  END SUBROUTINE item_operation
END MODULE procedure_intent_nonsense

Variants, which may all be just the result of the compiler thinking the pvec
argument is a procedure...

If the ParentVector component is switched to being the CLASS(Parent) component
and the PRINT statement in vector_operation is uncommented, a syntax error that
appears to be spurious is generated.

Alternatively, if the pvec dummy in item_option is changed to be
non-polymorphic, then two additional errors appear and the ICE disappears.  

One of the additional errors is "'array' argument of 'size' intrinsic at (1)
must be an array", referring to the SIZE intrinsic in the DO statement.  The
argument to the SIZE intrinsic is an array, so this error is spurious.

The other additional error is that there is a type mismatch with the argument
for in the CALL to item_operation (passed CLASS(...) to TYPE(...)).  I believe
this is also spurious.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-02-02 23:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-08  4:09 [Bug fortran/46356] New: Erroneous procedure/intent error and ICE for class dummy argument ian_harvey at bigpond dot com
2010-11-08  8:31 ` [Bug fortran/46356] [OOP] " janus at gcc dot gnu.org
2010-11-08  9:32 ` janus at gcc dot gnu.org
2011-12-11 20:46 ` pault at gcc dot gnu.org
2011-12-12  8:19 ` burnus at gcc dot gnu.org
2012-01-04 10:27 ` burnus at gcc dot gnu.org
2012-01-04 19:14 ` burnus at gcc dot gnu.org
2012-02-02 23:15 ` mikael at gcc dot gnu.org
2012-02-02 23:26 ` mikael at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).