* tree-loop-distribution.c (struct partition): New field recording
[official-gcc.git] / gcc / testsuite / gfortran.dg / random_seed_1.f90
blob39c81ce51b794b769dfcd7c2302b3a345ceb2ed8
1 ! { dg-do compile }
3 ! Emit a diagnostic for too small PUT array at compile time
4 ! See PR fortran/37159
6 ! Updated to check for arrays of unexpected size,
7 ! this also works for -fdefault-integer-8.
10 PROGRAM random_seed_1
11 IMPLICIT NONE
13 INTEGER, PARAMETER :: nbytes = 128
15 ! +1 due to the special 'p' value in xorshift1024*
16 ! '+1' to avoid out-of-bounds warnings
17 INTEGER, PARAMETER :: n = nbytes / KIND(n) + 2
18 INTEGER, DIMENSION(n) :: seed
20 ! Get seed, array too small
21 CALL RANDOM_SEED(GET=seed(1:(n-2))) ! { dg-error "too small" }
23 ! Get seed, array bigger than necessary
24 CALL RANDOM_SEED(GET=seed(1:n))
26 ! Get seed, proper size
27 CALL RANDOM_SEED(GET=seed(1:(n-1)))
29 ! Put too few bytes
30 CALL RANDOM_SEED(PUT=seed(1:(n-2))) ! { dg-error "too small" }
32 ! Put too many bytes
33 CALL RANDOM_SEED(PUT=seed(1:n))
35 ! Put the right amount of bytes
36 CALL RANDOM_SEED(PUT=seed(1:(n-1)))
37 END PROGRAM random_seed_1