annotate gcc/testsuite/gfortran.dg/transfer_simplify_1.f90 @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 84e7813d76e9
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run }
kono
parents:
diff changeset
2 ! { dg-options "-O2" }
kono
parents:
diff changeset
3 ! { dg-skip-if "NaN not supported" { spu-*-* } }
kono
parents:
diff changeset
4 ! Tests that the PRs caused by the lack of gfc_simplify_transfer are
kono
parents:
diff changeset
5 ! now fixed. These were brought together in the meta-bug PR31237
kono
parents:
diff changeset
6 ! (TRANSFER intrinsic).
kono
parents:
diff changeset
7 ! Remaining PRs on 20070409 :-18769 30881 31194 31216 31424 31427
kono
parents:
diff changeset
8 !
kono
parents:
diff changeset
9 program simplify_transfer
kono
parents:
diff changeset
10 CHARACTER(LEN=100) :: buffer="1.0 3.0"
kono
parents:
diff changeset
11 call pr18769 ()
kono
parents:
diff changeset
12 call pr30881 ()
kono
parents:
diff changeset
13 call pr31194 ()
kono
parents:
diff changeset
14 call pr31216 ()
kono
parents:
diff changeset
15 call pr31427 ()
kono
parents:
diff changeset
16 contains
kono
parents:
diff changeset
17 subroutine pr18769 ()
kono
parents:
diff changeset
18 !
kono
parents:
diff changeset
19 ! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
kono
parents:
diff changeset
20 !
kono
parents:
diff changeset
21 implicit none
kono
parents:
diff changeset
22 type t
kono
parents:
diff changeset
23 integer :: i
kono
parents:
diff changeset
24 end type t
kono
parents:
diff changeset
25 type (t), parameter :: u = t (42)
kono
parents:
diff changeset
26 integer, parameter :: idx_list(1) = (/ 1 /)
kono
parents:
diff changeset
27 integer :: j(1) = transfer (u, idx_list)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
28 if (j(1) .ne. 42) STOP 1
111
kono
parents:
diff changeset
29 end subroutine pr18769
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 subroutine pr30881 ()
kono
parents:
diff changeset
32 !
kono
parents:
diff changeset
33 ! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
kono
parents:
diff changeset
34 !
kono
parents:
diff changeset
35 INTEGER, PARAMETER :: K=1
kono
parents:
diff changeset
36 INTEGER :: I
kono
parents:
diff changeset
37 I=TRANSFER(.TRUE.,K)
kono
parents:
diff changeset
38 SELECT CASE(I)
kono
parents:
diff changeset
39 CASE(TRANSFER(.TRUE.,K))
kono
parents:
diff changeset
40 CASE(TRANSFER(.FALSE.,K))
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
41 STOP 2
111
kono
parents:
diff changeset
42 CASE DEFAULT
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
43 STOP 3
111
kono
parents:
diff changeset
44 END SELECT
kono
parents:
diff changeset
45 I=TRANSFER(.FALSE.,K)
kono
parents:
diff changeset
46 SELECT CASE(I)
kono
parents:
diff changeset
47 CASE(TRANSFER(.TRUE.,K))
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
48 STOP 4
111
kono
parents:
diff changeset
49 CASE(TRANSFER(.FALSE.,K))
kono
parents:
diff changeset
50 CASE DEFAULT
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
51 STOP 5
111
kono
parents:
diff changeset
52 END SELECT
kono
parents:
diff changeset
53 END subroutine pr30881
kono
parents:
diff changeset
54
kono
parents:
diff changeset
55 subroutine pr31194 ()
kono
parents:
diff changeset
56 !
kono
parents:
diff changeset
57 ! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
kono
parents:
diff changeset
58 !
kono
parents:
diff changeset
59 real(kind(0d0)) :: NaN = transfer(ishft(int(z'FFF80000',8),32),0d0)
kono
parents:
diff changeset
60 write (buffer,'(e12.5)') NaN
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
61 if (buffer(10:12) .ne. "NaN") STOP 6
111
kono
parents:
diff changeset
62 end subroutine pr31194
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 subroutine pr31216 ()
kono
parents:
diff changeset
65 !
kono
parents:
diff changeset
66 ! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
kono
parents:
diff changeset
67 !
kono
parents:
diff changeset
68 INTEGER :: I
kono
parents:
diff changeset
69 REAL :: C,D
kono
parents:
diff changeset
70 buffer = " 1.0 3.0"
kono
parents:
diff changeset
71 READ(buffer,*) C,D
kono
parents:
diff changeset
72 I=TRANSFER(C/D,I)
kono
parents:
diff changeset
73 SELECT CASE(I)
kono
parents:
diff changeset
74 CASE (TRANSFER(1.0/3.0,1))
kono
parents:
diff changeset
75 CASE DEFAULT
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
76 STOP 7
111
kono
parents:
diff changeset
77 END SELECT
kono
parents:
diff changeset
78 END subroutine pr31216
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 subroutine pr31427 ()
kono
parents:
diff changeset
81 !
kono
parents:
diff changeset
82 ! Contributed by Michael Richmond <michael.a.richmond@nasa.gov>
kono
parents:
diff changeset
83 !
kono
parents:
diff changeset
84 INTEGER(KIND=1) :: i(1)
kono
parents:
diff changeset
85 i = (/ TRANSFER("a", 0_1) /)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
86 if (i(1) .ne. ichar ("a")) STOP 8
111
kono
parents:
diff changeset
87 END subroutine pr31427
kono
parents:
diff changeset
88 end program simplify_transfer