File: associate_23.f90

package info (click to toggle)
lfortran 0.60.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 58,412 kB
  • sloc: cpp: 173,406; f90: 80,491; python: 17,586; ansic: 9,610; yacc: 2,356; sh: 1,401; fortran: 895; makefile: 37; javascript: 15
file content (30 lines) | stat: -rw-r--r-- 847 bytes parent folder | download
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
program pointer_lhs_section_bug
    implicit none

    real, target :: arr(6)
    real, pointer :: mat(:), mat1(:)
    integer :: n

    n = 6
    arr = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]

    mat(1:n-3) => arr
    print *, "Test 1: mat(1:n-3) => arr"
    print *, "  mat:", mat
    print *, "  lbound:", lbound(mat)
    print *, "  ubound:", ubound(mat)

    if (any(mat /= [1.0, 2.0, 3.0])) error stop
    if (any(lbound(mat) /= 1)) error stop
    if (any(ubound(mat) /= 3)) error stop

    mat1(1+2:n+2) => arr
    print *, "Test 2: mat1(1+2:n+2) => arr"
    print *, "  mat1:", mat1
    print *, "  lbound:", lbound(mat1)
    print *, "  ubound:", ubound(mat1)
    if (any(mat1 /= [1.0, 2.0, 3.0, 4.0, 5.0, 6.0])) error stop
    if (any(lbound(mat1) /= 3)) error stop
    if (any(ubound(mat1) /= 8)) error stop

end program pointer_lhs_section_bug