2 ! { dg-options "-std=f2008" }
6 ! Check for pointer remapping compile-time errors.
8 ! Contributed by Daniel Kraft, d@domob.eu.
12 INTEGER, TARGET :: arr(12), basem(3, 4)
13 INTEGER, POINTER :: vec(:), mat(:, :)
15 ! Existence of reference elements.
16 vec(:) => arr ! { dg-error "Lower bound has to be present" }
17 vec(5:7:1) => arr ! { dg-error "Stride must not be present" }
18 mat(1:, 2:5) => arr ! { dg-error "Either all or none of the upper bounds" }
19 mat(2, 6) => arr ! { dg-error "Expected bounds specification" }
21 ! This is bound remapping not rank remapping!
22 mat(1:, 3:) => arr ! { dg-error "Different ranks" }
24 ! Invalid remapping target; for non-rank one we already check the F2008
25 ! error elsewhere. Here, test that not-contiguous target is disallowed
27 mat(1:2, 1:3) => arr(1:12:2) ! This is ok, rank one target.
28 vec(1:8) => basem(1:3:2, :) ! { dg-error "rank 1 or simply contiguous" }
30 ! Target is smaller than pointer.
31 vec(1:20) => arr ! { dg-error "smaller than size of the pointer" }
32 vec(1:10) => arr(1:12:2) ! { dg-error "smaller than size of the pointer" }
33 vec(1:20) => basem(:, :) ! { dg-error "smaller than size of the pointer" }
34 mat(1:5, 1:5) => arr ! { dg-error "smaller than size of the pointer" }