From: H.J. Lu Date: Thu, 29 Jan 2009 17:43:14 +0000 (+0000) Subject: [multiple changes] X-Git-Tag: releases/gcc-4.3.4~371 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77a774eea0e8ef72362e9fe852c75b83b933d307;p=thirdparty%2Fgcc.git [multiple changes] 2009-01-29 H.J. Lu 2009-01-28 Richard Guenther PR middle-end/38908 * g++.dg/warn/Wuninitialized-2.C: New testcase. 2009-01-27 Daniel Kraft PR fortran/38883 * gfortran.dg/mvbits_6.f90: New test. * gfortran.dg/mvbits_7.f90: New test. * gfortran.dg/mvbits_8.f90: New test. 2009-01-21 Daniel Kraft PR fortran/38887 * gfortran.dg/mvbits_5.f90: New test. From-SVN: r143765 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 12b3b017a4d6..05c350719bc7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,22 @@ +2009-01-29 H.J. Lu + + 2009-01-28 Richard Guenther + + PR middle-end/38908 + * g++.dg/warn/Wuninitialized-2.C: New testcase. + + 2009-01-27 Daniel Kraft + + PR fortran/38883 + * gfortran.dg/mvbits_6.f90: New test. + * gfortran.dg/mvbits_7.f90: New test. + * gfortran.dg/mvbits_8.f90: New test. + + 2009-01-21 Daniel Kraft + + PR fortran/38887 + * gfortran.dg/mvbits_5.f90: New test. + 2009-01-29 H.J. Lu Backport from mainline: diff --git a/gcc/testsuite/g++.dg/warn/Wuninitialized-2.C b/gcc/testsuite/g++.dg/warn/Wuninitialized-2.C new file mode 100644 index 000000000000..2b6f9253012d --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wuninitialized-2.C @@ -0,0 +1,53 @@ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +struct S8 { template S8(T) { } }; + +template struct S10; +template struct S10 { typedef T S12; typedef S8 S1(); }; + +template struct S3 { }; +template struct S11 { S11(S3); }; + +struct S2 +{ + template operator S11() { return S11(S5()); } + template struct S5:public S3 + { + virtual typename S10::S12 S13() { + return 0; + } + }; +}; + +template S11 S6(S3) { return S11(S3()); } +template struct S7 { typedef S12 S15(); }; + +struct S4 +{ + template operator S11() + { + struct S14:public S3 + { + S14(S2 x):S11_(x) { } + S11::S12>::S15> S11_; + }; + return S6(S14(S11_)); + } + S2 S11_; +}; + +struct S9 +{ + template operator S11() { return S11(S14(S11_)); } + template struct S14:public S3 + { + S14(S4 x):S11_(x) { } + S11::S1> S11_; + }; + S4 S11_; +}; + +void S15(S11); +void S16() { S9 x; S15(x); } + diff --git a/gcc/testsuite/gfortran.dg/mvbits_5.f90 b/gcc/testsuite/gfortran.dg/mvbits_5.f90 new file mode 100644 index 000000000000..42d834668ec1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/mvbits_5.f90 @@ -0,0 +1,17 @@ +! { dg-do run } + +! PR fortran/38887 +! This aborted at runtime for the runtime zero-sized array arguments. + +! Contributed by Dick Hendrickson + +program try_ya0013 + integer ida(9) + call ya0013(ida,1,5,6) +end program + +SUBROUTINE YA0013(IDA,nf1,nf5,nf6) + INTEGER IDA(9) + IDA = 1 + CALL MVBITS(IDA(NF5:NF1), 0, 1, IDA(NF6:NF1),2) +END SUBROUTINE diff --git a/gcc/testsuite/gfortran.dg/mvbits_6.f90 b/gcc/testsuite/gfortran.dg/mvbits_6.f90 new file mode 100644 index 000000000000..c8986df21ca1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/mvbits_6.f90 @@ -0,0 +1,33 @@ +! { dg-do compile } + +! PR fortran/38883 +! This ICE'd because the temporary-creation in the MVBITS call was wrong. +! This is the original test from the PR, the complicated version. + +! Contributed by Dick Hendrickson + + module yg0009_stuff + + type unseq + integer I + end type + + contains + + SUBROUTINE YG0009(TDA2L,NF4,NF3,NF1,MF1,MF4,MF3) + TYPE(UNSEQ) TDA2L(NF4,NF3) + + CALL MVBITS (TDA2L(NF4:NF1:MF1,NF1:NF3)%I,2, & + 4, TDA2L(-MF4:-MF1:-NF1,-MF1:-MF3)%I, 3) + + END SUBROUTINE + + end module yg0009_stuff + + program try_yg0009 + use yg0009_stuff + type(unseq) tda2l(4,3) + + call yg0009(tda2l,4,3,1,-1,-4,-3) + + end diff --git a/gcc/testsuite/gfortran.dg/mvbits_7.f90 b/gcc/testsuite/gfortran.dg/mvbits_7.f90 new file mode 100644 index 000000000000..2c7cab8ac249 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/mvbits_7.f90 @@ -0,0 +1,30 @@ +! { dg-do run } + +! PR fortran/38883 +! This ICE'd because the temporary-creation in the MVBITS call was wrong. + +! Contributed by Paul Richard Thomas + + type t + integer :: I + character(9) :: chr + end type + type(t) :: x(4,3) + type(t) :: y(4,3) + x = reshape ([((t (i*j, "a"),i = 1,4), j=1,3)], [4,3]) + call foo (x) + y = reshape ([((t (i*j*2, "a"),i = 1,4), j=1,3)], [4,3]) + call bar(y, 4, 3, 1, -1, -4, -3) + if (any (x%i .ne. y%i)) call abort +contains + SUBROUTINE foo (x) + TYPE(t) x(4, 3) ! No dependency at all + CALL MVBITS (x%i, 0, 6, x%i, 8) + x%i = x%i * 2 + END SUBROUTINE + SUBROUTINE bar (x, NF4, NF3, NF1, MF1, MF4, MF3) + TYPE(t) x(NF4, NF3) ! Dependency through variable indices + CALL MVBITS (x(NF4:NF1:MF1, NF1:NF3)%i, 1, & + 6, x(-MF4:-MF1:-NF1, -MF1:-MF3)%i, 9) + END SUBROUTINE +end diff --git a/gcc/testsuite/gfortran.dg/mvbits_8.f90 b/gcc/testsuite/gfortran.dg/mvbits_8.f90 new file mode 100644 index 000000000000..f69d1e84f9a0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/mvbits_8.f90 @@ -0,0 +1,36 @@ +! { dg-do run } + +! PR fortran/38883 +! This ICE'd because the temporary-creation in the MVBITS call was wrong. + +PROGRAM main + IMPLICIT NONE + + TYPE inner + INTEGER :: i + INTEGER :: j + END TYPE inner + + TYPE outer + TYPE(inner) :: comp(2) + END TYPE outer + + TYPE(outer) :: var + + var%comp%i = (/ 1, 2 /) + var%comp%j = (/ 3, 4 /) + + CALL foobar (var, 1, 2) + + IF (ANY (var%comp%i /= (/ 1, 2 /))) CALL abort () + IF (ANY (var%comp%j /= (/ 3, 4 /))) CALL abort () + +CONTAINS + + SUBROUTINE foobar (x, lower, upper) + TYPE(outer), INTENT(INOUT) :: x + INTEGER, INTENT(IN) :: lower, upper + CALL MVBITS (x%comp%i, 1, 2, x%comp(lower:upper)%i, 1) + END SUBROUTINE foobar + +END PROGRAM main