summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/mvbits_8.f90
blob: f69d1e84f9a0d572b8754c65da667e622cf51a2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
! { dg-do run }

! PR fortran/38883
! This ICE'd because the temporary-creation in the MVBITS call was wrong.

PROGRAM main
  IMPLICIT NONE

  TYPE inner
    INTEGER :: i
    INTEGER :: j
  END TYPE inner

  TYPE outer
    TYPE(inner) :: comp(2)
  END TYPE outer

  TYPE(outer) :: var

  var%comp%i = (/ 1, 2 /)
  var%comp%j = (/ 3, 4 /)

  CALL foobar (var, 1, 2)

  IF (ANY (var%comp%i /= (/ 1, 2 /))) CALL abort ()
  IF (ANY (var%comp%j /= (/ 3, 4 /))) CALL abort ()

CONTAINS

  SUBROUTINE foobar (x, lower, upper)
    TYPE(outer), INTENT(INOUT) :: x
    INTEGER, INTENT(IN) :: lower, upper
    CALL MVBITS (x%comp%i, 1, 2, x%comp(lower:upper)%i, 1)
  END SUBROUTINE foobar

END PROGRAM main