xref: /llvm-project/flang/test/Semantics/pointer01.f90 (revision c66645da55b9f4c13f4a612392dcc5a84b086ba7)
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
2module m
3  real mobj
4 contains
5  subroutine msubr
6  end subroutine
7end module
8program main
9  use m
10  !PORTABILITY: Name 'main' declared in a main program should not have the same name as the main program
11  pointer main
12  !ERROR: Cannot change POINTER attribute on use-associated 'mobj'
13  pointer mobj
14  !ERROR: Cannot change POINTER attribute on use-associated 'msubr'
15  pointer msubr
16  !ERROR: 'inner' cannot have the POINTER attribute
17  pointer inner
18  real obj
19  !ERROR: 'ip' may not have both the POINTER and PARAMETER attributes
20  integer, parameter :: ip = 123
21  pointer ip
22  type dt; end type
23  !ERROR: 'dt' cannot have the POINTER attribute
24  pointer dt
25  interface generic
26    subroutine extsub
27    end subroutine
28  end interface
29  !ERROR: 'generic' cannot have the POINTER attribute
30  pointer generic
31  namelist /nml/ obj
32  !ERROR: 'nml' cannot have the POINTER attribute
33  pointer nml
34 contains
35  subroutine inner
36  end subroutine
37end
38