]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
This commit was manufactured by cvs2svn to create branch
authorNo Author <no-author@gcc.gnu.org>
Mon, 20 Jun 2005 20:16:59 +0000 (20:16 +0000)
committerNo Author <no-author@gcc.gnu.org>
Mon, 20 Jun 2005 20:16:59 +0000 (20:16 +0000)
'gcc-4_0-branch'.

From-SVN: r101217

gcc/testsuite/g++.dg/conversion/simd2.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr21985.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/backslash_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/backslash_2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/duplicate_labels.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/f2c_6.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr19926.f90 [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/conversion/simd2.C b/gcc/testsuite/g++.dg/conversion/simd2.C
new file mode 100644 (file)
index 0000000..873e707
--- /dev/null
@@ -0,0 +1,16 @@
+/* { 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 +" } */
+} 
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21985.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21985.c
new file mode 100644 (file)
index 0000000..da0a370
--- /dev/null
@@ -0,0 +1,33 @@
+/* { 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" } } */
diff --git a/gcc/testsuite/gfortran.dg/backslash_1.f90 b/gcc/testsuite/gfortran.dg/backslash_1.f90
new file mode 100644 (file)
index 0000000..db7ddbc
--- /dev/null
@@ -0,0 +1,9 @@
+! { 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
diff --git a/gcc/testsuite/gfortran.dg/backslash_2.f90 b/gcc/testsuite/gfortran.dg/backslash_2.f90
new file mode 100644 (file)
index 0000000..2f954d5
--- /dev/null
@@ -0,0 +1,11 @@
+! { 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
diff --git a/gcc/testsuite/gfortran.dg/duplicate_labels.f90 b/gcc/testsuite/gfortran.dg/duplicate_labels.f90
new file mode 100644 (file)
index 0000000..7523d0c
--- /dev/null
@@ -0,0 +1,59 @@
+! { 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
diff --git a/gcc/testsuite/gfortran.dg/f2c_6.f90 b/gcc/testsuite/gfortran.dg/f2c_6.f90
new file mode 100644 (file)
index 0000000..b276b3d
--- /dev/null
@@ -0,0 +1,84 @@
+! { 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
diff --git a/gcc/testsuite/gfortran.dg/pr19926.f90 b/gcc/testsuite/gfortran.dg/pr19926.f90
new file mode 100644 (file)
index 0000000..34991ec
--- /dev/null
@@ -0,0 +1,25 @@
+! { 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
+