aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/array_temporaries_1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/array_temporaries_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/array_temporaries_1.f9019
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/array_temporaries_1.f90 b/gcc/testsuite/gfortran.dg/array_temporaries_1.f90
new file mode 100644
index 00000000000..64fc59046f4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/array_temporaries_1.f90
@@ -0,0 +1,19 @@
+! { dg-do compile }
+! { dg-options "-Warray-temporaries" }
+
+subroutine bar(a)
+ real, dimension(2) :: a
+end
+
+program main
+ integer, parameter :: n=3
+ integer :: i
+ real, dimension(n) :: a, b
+
+ a = 0.2
+ i = 2
+ a(i:i+1) = a(1:2) ! { dg-warning "Creating array temporary" }
+ a = cshift(a,1) ! { dg-warning "Creating array temporary" }
+ b = cshift(a,1)
+ call bar(a(1:3:2)) ! { dg-warning "Creating array temporary" }
+end program main