OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gfortran.dg/] [typebound_call_3.f03] - Rev 437

Go to most recent revision | Compare with Previous | Blame | View Log

! { dg-do run }

! Type-bound procedures
! Check that calls work across module-boundaries.

MODULE m
  IMPLICIT NONE

  TYPE trueOrFalse
    LOGICAL :: val
  CONTAINS
    PROCEDURE, PASS :: swap
  END TYPE trueOrFalse

CONTAINS

  SUBROUTINE swap (me1, me2)
    IMPLICIT NONE
    CLASS(trueOrFalse), INTENT(INOUT) :: me1, me2

    IF (.NOT. me1%val .OR. me2%val) THEN
      CALL abort ()
    END IF
    
    me1%val = .FALSE.
    me2%val = .TRUE.
  END SUBROUTINE swap

END MODULE m

PROGRAM main
  USE m, ONLY: trueOrFalse
  IMPLICIT NONE

  TYPE(trueOrFalse) :: t, f

  t%val = .TRUE.
  f%val = .FALSE.

  CALL t%swap (f)
  CALL f%swap (t)

  IF (.NOT. t%val .OR. f%val) THEN
    CALL abort ()
  END IF
END PROGRAM main

! { dg-final { cleanup-modules "m" } }

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.