'gcc-4_0-branch'.
From-SVN: r101217
--- /dev/null
+/* { dg-do compile } */
+
+/* Test generic operations on vectors. */
+
+int __attribute__((vector_size(16))) a, b, c;
+int __attribute__((vector_size(8))) d;
+void foo()
+{
+ a = b ^ c;
+ a = b + c;
+ a = b - c;
+ a = b * c;
+ a = b / c;
+ a = -b;
+ a = d + b; /* { dg-error "invalid operands to binary +" } */
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-vars" } */
+
+struct
+{
+ struct
+ {
+ int a;
+ int b;
+ } a[100];
+} a;
+
+typedef __SIZE_TYPE__ size_t;
+void foo(size_t);
+size_t *bar (void);
+
+int
+main (void)
+{
+ size_t *b = bar ();
+
+ /* This should be folded. */
+ foo (&a.a[50].a - &a.a[33].b);
+ foo ((size_t) &a.a[50].b - (size_t) &a);
+
+ /* And this should not. */
+ foo ((size_t) &b - (size_t) b);
+ return 0;
+}
+
+/* Two of the calls to foo should be folded to just foo(constant). */
+
+/* { dg-final { scan-tree-dump-times "foo \\(\[0-9\]*\\)" 2 "vars" } } */
--- /dev/null
+! { dg-do run }
+! { dg-options "-fno-backslash" }
+ character(len=4) a
+ open (10, status='scratch')
+ write (10,'(A)') '1\n2'
+ rewind (10)
+ read (10,'(A)') a
+ if (a /= '1\n2') call abort
+ end
--- /dev/null
+! { dg-do run }
+! { dg-options "-fbackslash" }
+ integer :: i, e
+ open (10, status='scratch')
+ write (10,'(A)') '1\n2'
+ rewind (10)
+ read (10,*,iostat=e) i
+ if (e /= 0 .or. i /= 1) call abort
+ read (10,*,iostat=e) i
+ if (e /= 0 .or. i /= 2) call abort
+ end
--- /dev/null
+! { dg-do compile }
+! PR 21257
+program dups
+
+ integer i,j,k
+
+ abc: do i = 1, 3
+ abc: do j = 1, 3 ! { dg-error "Duplicate construct label" }
+ k = i + j
+ end do abc
+ end do abc ! { dg-error "Expecting END PROGRAM" }
+
+ xyz: do i = 1, 2
+ k = i + 2
+ end do xyz
+ xyz: do j = 1, 5 ! { dg-error "Duplicate construct label" }
+ k = j + 2
+ end do loop ! { dg-error "Expecting END PROGRAM" }
+
+ her: if (i == 1) then
+ her: if (j == 1) then ! { dg-error "Duplicate construct label" }
+ k = i + j
+ end if her
+ end if her ! { dg-error "Expecting END PROGRAM" }
+
+ his: if (i == 1) then
+ i = j
+ end if his
+ his: if (j === 1) then ! { dg-error "Duplicate construct label" }
+ print *, j
+ end if his ! { dg-error "Expecting END PROGRAM" }
+
+ sgk: select case (i)
+ case (1)
+ sgk: select case (j) ! { dg-error "Duplicate construct label" }
+ case (10)
+ i = i + j
+ case (20)
+ j = j + i
+ end select sgk
+ case (2) ! { dg-error "Unexpected CASE statement" }
+ i = i + 1
+ j = j + 1
+ end select sgk ! { dg-error "Expecting END PROGRAM" }
+
+ apl: select case (i)
+ case (1)
+ k = 2
+ case (2)
+ j = 1
+ end select apl
+ apl: select case (i) ! { dg-error "Duplicate construct label" }
+ case (1) ! { dg-error "Unexpected CASE statement" }
+ j = 2
+ case (2) ! { dg-error "Unexpected CASE statement" }
+ k = 1
+ end select apl ! { dg-error "Expecting END PROGRAM" }
+
+end program dups
--- /dev/null
+! { dg-do run }
+! { dg-options "-ff2c" }
+! Verifies that complex pointer results work with -ff2c
+! try all permutations of result clause in function yes/no
+! and result clause in interface yes/no
+! this is not possible in Fortran 77, but this exercises a previously
+! buggy codepath
+function c() result (r)
+ common // z
+ complex, pointer :: r
+ complex, target :: z
+
+ r=>z
+end function c
+
+function d()
+ common // z
+ complex, pointer :: d
+ complex, target :: z
+
+ d=>z
+end function d
+
+function e()
+ common // z
+ complex, pointer :: e
+ complex, target :: z
+
+ e=>z
+end function e
+
+function f() result(r)
+ common // z
+ complex, pointer :: r
+ complex, target :: z
+
+ r=>z
+end function f
+
+interface
+ function c
+ complex, pointer :: c
+ end function c
+end interface
+interface
+ function d
+ complex, pointer :: d
+ end function d
+end interface
+interface
+ function e result(r)
+ complex, pointer :: r
+ end function e
+end interface
+interface
+ function f result(r)
+ complex, pointer :: r
+ end function f
+end interface
+
+common // z
+complex, target :: z
+complex, pointer :: p
+
+z = (1.,0.)
+p => c()
+z = (2.,0.)
+if (p /= z) call abort ()
+
+NULLIFY(p)
+p => d()
+z = (3.,0.)
+if (p /= z) call abort ()
+
+NULLIFY(p)
+p => e()
+z = (4.,0.)
+if (p /= z) call abort ()
+
+NULLIFY(p)
+p => f()
+z = (5.,0.)
+if (p /= z) call abort ()
+end
--- /dev/null
+! { dg-do run }
+module b
+ type cat
+ integer :: i = 0
+ end type cat
+end module b
+
+program a
+ use b
+ type(cat) z
+ integer :: i = 0, j(4,3,2) = 0
+ call string_comp(i)
+ if (i /= 3) call abort
+ call string_comp(z%i)
+ if (z%i /= 3) call abort
+ call string_comp(j(1,2,1))
+ if (j(1,2,1) /= 3) call abort
+end program a
+
+subroutine string_comp(i)
+ integer, parameter :: map(0:50) = 3
+ integer :: i
+ i = map(42)
+end subroutine string_comp
+