Plugins: Add label-text.h to CPPLIB_H so it will be installed [PR115288]
[official-gcc.git] / gcc / testsuite / gfortran.dg / pr107000.f90
blob30289078c575700abd7bcb68ef10bc938086afa2
1 ! { dg-do compile }
2 ! PR fortran/107000 - ICE in gfc_real2complex, reduce_unary, reduce_binary_*
3 ! Contributed by G.Steinmetz
5 program p
6 real :: y(1)
7 complex :: x(1)
8 x = (1.0, 2.0) * [real :: -'1'] ! { dg-error "Operand of unary numeric operator" }
9 x = (1.0, 2.0) * [complex :: +'1'] ! { dg-error "Operand of unary numeric operator" }
10 x = [complex :: -'1'] * (1.0, 2.0) ! { dg-error "Operand of unary numeric operator" }
11 y = [complex :: -'1'] * 2 ! { dg-error "Operand of unary numeric operator" }
12 y = 2 * [complex :: -'1'] ! { dg-error "Operand of unary numeric operator" }
13 y = 2 * [complex :: -(.true.)] ! { dg-error "Operand of unary numeric operator" }
14 y = [complex :: -(.true.)] * 2 ! { dg-error "Operand of unary numeric operator" }
15 print *, - [real :: -'1' ] ! { dg-error "Operand of unary numeric operator" }
16 print *, - [real :: [-'1']] ! { dg-error "Operand of unary numeric operator" }
17 print *, - [real :: +(.true.) ] ! { dg-error "Operand of unary numeric operator" }
18 print *, - [real :: [+(.true.)]] ! { dg-error "Operand of unary numeric operator" }
19 print *, 2 * [real :: -'1' ] ! { dg-error "Operand of unary numeric operator" }
20 print *, 2 * [real :: (-'1')] ! { dg-error "Operand of unary numeric operator" }
21 print *, [real :: -'1' ] * 2 ! { dg-error "Operand of unary numeric operator" }
22 print *, [real :: (-'1')] * 2 ! { dg-error "Operand of unary numeric operator" }
23 print *, 2 * [integer :: -('1')] ! { dg-error "Operand of unary numeric operator" }
24 print *, [integer :: -('1')] * 2 ! { dg-error "Operand of unary numeric operator" }
25 print *, 2 * [real :: 0, (-'1')] ! { dg-error "Operand of unary numeric operator" }
26 print *, [real :: 0, (-'1')] * 2 ! { dg-error "Operand of unary numeric operator" }
27 print *, 2 * [real :: 0, -'1'] ! { dg-error "Operand of unary numeric operator" }
28 print *, [real :: 0, -'1'] * 2 ! { dg-error "Operand of unary numeric operator" }
29 print *, 2 * [real :: 0, 1+'1'] ! { dg-error "Operands of binary numeric operator" }
30 print *, [real :: 0, 1+'1'] * 2 ! { dg-error "Operands of binary numeric operator" }
31 print *, [real :: 1, +(.true.)] ! { dg-error "Operand of unary numeric operator" }
32 print *, [real :: 1, -(.true.)] ! { dg-error "Operand of unary numeric operator" }
33 print *, 2 * [real :: 1, +(.true.)] ! { dg-error "Operand of unary numeric operator" }
34 print *, [real :: 1, +(.true.)] * 2 ! { dg-error "Operand of unary numeric operator" }
35 print *, [1, 2] * [real :: 1, +(.true.)] ! { dg-error "Operand of unary numeric operator" }
36 print *, [real :: 1, +(.true.)] * [1, 2] ! { dg-error "Operand of unary numeric operator" }
37 print *, [real :: 1, 2] * [real :: 1, +(.true.)] ! { dg-error "Operand of unary numeric operator" }
38 print *, [real :: 1, +(.true.)] * [real :: 1, 2] ! { dg-error "Operand of unary numeric operator" }
39 print *, [real :: 0, -'1'] * [real :: 1, +(+(.true.))] ! { dg-error "Operand of unary numeric operator" }
40 print *, [real :: 1, [(+(.true.))]] * [real :: 0, [(-'1')]] ! { dg-error "Operand of unary numeric operator" }
42 ! Legal:
43 print *, 2 * [real :: 1, [2], 3]
44 print *, [real :: 1, [2], 3] * 2
45 print *, [real :: 1, [2], 3] * [real :: 1, [2], 3]
46 print *, [real :: 1, [2], 3] * [integer :: 1, [2], 3]
47 print *, [real :: 1, [2], 3] * [1, [2], 3]
48 print *, [real :: 1, huge(2.0)] * [real :: 1, real(1.0)]
49 print *, [real :: 1, -(huge(2.0))] * [real :: 1, +(real(1))]
50 end