From be20459e0a6cdb0f73369b95024a51f57d983055 Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Sun, 31 Oct 2004 20:42:27 +0000 Subject: [PATCH] Integrate some patches extracted from gcc-3.4_3.4.2-3.diff. --- toolchain/gcc/3.4.2/300-libstdc++-pic.patch | 47 ++++ toolchain/gcc/3.4.2/300-pr15526.patch | 53 +++++ toolchain/gcc/3.4.2/300-pr17541.patch | 234 ++++++++++++++++++++ toolchain/gcc/3.4.2/300-pr17976.patch | 106 +++++++++ 4 files changed, 440 insertions(+) create mode 100644 toolchain/gcc/3.4.2/300-libstdc++-pic.patch create mode 100644 toolchain/gcc/3.4.2/300-pr15526.patch create mode 100644 toolchain/gcc/3.4.2/300-pr17541.patch create mode 100644 toolchain/gcc/3.4.2/300-pr17976.patch diff --git a/toolchain/gcc/3.4.2/300-libstdc++-pic.patch b/toolchain/gcc/3.4.2/300-libstdc++-pic.patch new file mode 100644 index 0000000000..c030ba6205 --- /dev/null +++ b/toolchain/gcc/3.4.2/300-libstdc++-pic.patch @@ -0,0 +1,47 @@ +# DP: Build and install libstdc++_pic.a library. + +--- gcc/libstdc++-v3/src/Makefile.am~ 2003-02-28 09:21:05.000000000 +0100 ++++ gcc/libstdc++-v3/src/Makefile.am 2003-02-28 09:28:50.000000000 +0100 +@@ -224,6 +224,10 @@ + @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@ + + ++install-exec-local: ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++ + # Added bits to build debug library. + if GLIBCPP_BUILD_DEBUG + all-local: build_debug + +--- gcc/libstdc++-v3/src/Makefile.in~ 2004-02-21 09:55:48.000000000 +0100 ++++ gcc/libstdc++-v3/src/Makefile.in 2004-02-21 09:59:34.000000000 +0100 +@@ -585,7 +585,7 @@ + + install-data-am: install-data-local + +-install-exec-am: install-toolexeclibLTLIBRARIES ++install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local + + install-info: install-info-am + +@@ -618,6 +618,7 @@ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-data-local \ + install-exec install-exec-am install-info install-info-am \ ++ install-exec-local \ + install-man install-strip install-toolexeclibLTLIBRARIES \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ +@@ -707,6 +708,11 @@ + install_debug: + (cd ${debugdir} && $(MAKE) \ + toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install) ++ ++install-exec-local: ++ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o ++ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir) ++ + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff --git a/toolchain/gcc/3.4.2/300-pr15526.patch b/toolchain/gcc/3.4.2/300-pr15526.patch new file mode 100644 index 0000000000..f01c59f114 --- /dev/null +++ b/toolchain/gcc/3.4.2/300-pr15526.patch @@ -0,0 +1,53 @@ +# DP: 2004-09-26 Roger Sayle +# DP: +# DP: PR other/15526 +# DP: Backport from mainline +# DP: 2004-05-20 Falk Hueffner +# DP: * libgcc2.c (__mulvsi3): Fix overflow test. + +diff -u -r1.170.6.1 -r1.170.6.2 +--- gcc/gcc/libgcc2.c 2004/07/17 21:18:47 1.170.6.1 ++++ gcc/gcc/libgcc2.c 2004/09/26 20:47:14 1.170.6.2 +@@ -130,9 +130,7 @@ + { + const DWtype w = (DWtype) a * (DWtype) b; + +- if (((a >= 0) == (b >= 0)) +- ? (UDWtype) w > (UDWtype) (((DWtype) 1 << (WORD_SIZE - 1)) - 1) +- : (UDWtype) w < (UDWtype) ((DWtype) -1 << (WORD_SIZE - 1))) ++ if ((Wtype) (w >> WORD_SIZE) != (Wtype) w >> (WORD_SIZE - 1)) + abort (); + + return w; + +/cvs/gcc/gcc/gcc/testsuite/gcc.dg/ftrapv-1.c,v --> standard output +revision 1.1.22.1 +--- gcc/gcc/testsuite/gcc.dg/ftrapv-1.c ++++ /dev/null 2004-10-15 06:22:06.980596000 +0000 +@@ -0,0 +1,25 @@ ++/* Copyright (C) 2004 Free Software Foundation. ++ ++ PR other/15526 ++ Verify correct overflow checking with -ftrapv. ++ ++ Written by Falk Hueffner, 20th May 2004. */ ++ ++/* { dg-do run } */ ++/* { dg-options "-ftrapv" } */ ++ ++__attribute__((noinline)) int ++mulv(int a, int b) ++{ ++ return a * b; ++} ++ ++int ++main() ++{ ++ mulv( 0, 0); ++ mulv( 0, -1); ++ mulv(-1, 0); ++ mulv(-1, -1); ++ return 0; ++} + diff --git a/toolchain/gcc/3.4.2/300-pr17541.patch b/toolchain/gcc/3.4.2/300-pr17541.patch new file mode 100644 index 0000000000..ca5fa09abb --- /dev/null +++ b/toolchain/gcc/3.4.2/300-pr17541.patch @@ -0,0 +1,234 @@ +# DP: 2004-09-21 Bud Davis +# DP: +# DP: PR fortran/17541 +# DP: * bld.c (ffebld_constant_new_real2_val): Fix typo, +# DP: +# DP: PR fortran/17541 +# DP: * g77.f-torture/execute/pr17541.f: New test. + +Index: gcc/gcc/f/bld.c +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/f/Attic/bld.c,v +retrieving revision 1.16.14.1 +retrieving revision 1.16.14.2 +diff -u -r1.16.14.1 -r1.16.14.2 +--- gcc/gcc/f/bld.c 12 Jul 2004 17:58:36 -0000 1.16.14.1 ++++ gcc/gcc/f/bld.c 21 Sep 2004 12:54:27 -0000 1.16.14.2 +@@ -1333,7 +1333,7 @@ + nc = malloc_new_kp (ffebld_constant_pool(), + "FFEBLD_constREAL2", + sizeof (*nc)); +- nc->consttype = FFEBLD_constREAL1; ++ nc->consttype = FFEBLD_constREAL2; + nc->u.real2 = val; + nc->hook = FFECOM_constantNULL; + nc->llink = NULL; +Index: gcc/gcc/testsuite/g77.f-torture/execute/pr17541.f +=================================================================== +RCS file: gcc/gcc/testsuite/g77.f-torture/execute/pr17541.f +diff -N gcc/gcc/testsuite/g77.f-torture/execute/pr17541.f +--- /dev/null 1 Jan 1970 00:00:00 -0000 ++++ gcc/gcc/testsuite/g77.f-torture/execute/pr17541.f 21 Sep 2004 12:54:35 -0000 1.1.2.1 +@@ -0,0 +1,202 @@ ++ program test ++ implicit none ++! check all types of data statements ++! pr 17541 ++ real r(2) ++ double precision s(2) ++ integer*1 ib(2) ++ integer*2 ih(2) ++ integer*4 iw(2) ++ integer*8 id(3) ++ logical*1 lb(2) ++ logical*2 lh(2) ++ logical*4 lw(2) ++ logical*8 ld(2) ++ character*1 a(2) ++ character*5 b(2) ++ complex c1(2) ++ complex*8 c2(2) ++ data r / 1.0,2.0 / ++ data s / 2.d0,1.d0/ ++ data ib / 1,-1 / ++ data ih / 2,100/ ++ data iw / 4,3560000 / ++ data id / 8,Z'ABCDEF01',Z'5555AAAA' / ++ data a / 'a', 'z' / ++ data b / 'xyz','abc'/ ++ data c1 /(1.0,2.0),(-1.0,-2.0)/ ++ data c2 /(1.d0,2.d0),(-1.d0,-2.d0)/ ++ data lb / .TRUE.,.FALSE. / ++ data lh / .TRUE.,.FALSE. / ++ data lw / .TRUE.,.FALSE. / ++ data ld / .TRUE.,.FALSE. / ++ logical dbug ++ data dbug /.FALSE./ ++! check the reals first ++ if (r(1).ne.1.0) then ++ if (dbug) then ++ print*,r(1), ' should be 1.0 ' ++ else ++ call abort ++ endif ++ endif ++ if (r(2).ne.2.0) then ++ if (dbug) then ++ print*,r(2), ' should be 2.0 ' ++ else ++ call abort ++ endif ++ endif ++ if (s(1).ne.2.d0) then ++ if (dbug) then ++ print*,s(1), ' xxshould be 2.d0 ' ++ else ++ call abort ++ endif ++ endif ++ if (s(2).ne.1.d0) then ++ if (dbug) then ++ print*,s(2), ' should be 1.d0 ' ++ else ++ call abort ++ endif ++ endif ++! now the integers ++ if (ib(1).ne.1) then ++ if (dbug) then ++ print*,ib(1), ' should be 1 ' ++ else ++ call abort ++ endif ++ endif ++ if (ib(2).ne.-1) then ++ if (dbug) then ++ print*,ib(2), ' should be -1 ' ++ else ++ call abort ++ endif ++ endif ++ if (ih(1).ne.2) then ++ if (dbug) then ++ print*,ih(2), ' should be 2 ' ++ else ++ call abort ++ endif ++ endif ++ if (ih(2).ne.100) then ++ if (dbug) then ++ print*,ih(2), ' should be 100 ' ++ else ++ call abort ++ endif ++ endif ++ if (iw(1).ne.4) then ++ if (dbug) then ++ print*,iw(1), ' should be 4 ' ++ else ++ call abort ++ endif ++ endif ++ if (iw(2).ne.3560000) then ++ if (dbug) then ++ print*,iw(2), ' should be 3560000 ' ++ else ++ call abort ++ endif ++ endif ++ if (id(1).ne.8) then ++ if (dbug) print*,id(1), ' should be 8 ' ++ call abort ++ endif ++ if (id(2).ne.Z'ABCDEF01') then ++ if (dbug) print*,id(2), " should be Z'ABCDEF01' " ++ call abort ++ endif ++ if (id(3).ne.Z'5555AAAA') then ++ if (dbug) print*,id(2), " should be Z'5555AAAA' " ++ call abort ++ endif ++! complex ++ if (c1(1).ne.(1.0,2.0)) then ++ if (dbug) then ++ print*,c1(1), ' should be (1.0,2.0) ' ++ else ++ call abort ++ endif ++ endif ++ if (c1(2).ne.(-1.0,-2.0)) then ++ if (dbug) then ++ print*,c1(2), ' should be (-1.0,-2.0) ' ++ else ++ call abort ++ endif ++ endif ++ if (c2(1).ne.(1.d0,2.d0)) then ++ if (dbug) then ++ print*,c2(1), ' should be (1.0,2.0) ' ++ else ++ call abort ++ endif ++ endif ++ if (c2(2).ne.(-1.d0,-2.d0)) then ++ if (dbug) then ++ print*,c2(2), ' should be (-1.0,-2.0) ' ++ else ++ call abort ++ endif ++ endif ++! character ++ if (a(1).ne.'a') then ++ if (dbug) then ++ print*,a(1), ' should be a ' ++ else ++ call abort ++ endif ++ endif ++ if (b(1).ne.'xyz') then ++ if (dbug) then ++ print*,b(1), ' should be xyz ' ++ else ++ call abort ++ endif ++ endif ++!logicals ++ if (.NOT.lb(1)) then ++ if (dbug) print*,lb(1), ' should be .T. ' ++ call abort ++ endif ++ if (lb(2)) then ++ if (dbug) print*,lb(2), ' should be .F. ' ++ call abort ++ endif ++ if (.NOT.lh(1)) then ++ if (dbug) print*,lh(1), ' should be .T. ' ++ call abort ++ endif ++ if (lh(2)) then ++ if (dbug) print*,lh(2), ' should be .F. ' ++ call abort ++ endif ++ if (.NOT.lw(1)) then ++ if (dbug) print*,lw(1), ' should be .T. ' ++ call abort ++ endif ++ if (lw(2)) then ++ if (dbug) print*,lw(2), ' should be .F. ' ++ call abort ++ endif ++ if (.NOT.ld(1)) then ++ if (dbug) then ++ print*,ld(1), ' should be .T. ' ++ else ++ call abort ++ endif ++ endif ++ if (ld(2)) then ++ if (dbug) then ++ print*,ld(2), ' should be .F. ' ++ else ++ call abort ++ endif ++ endif ++ end diff --git a/toolchain/gcc/3.4.2/300-pr17976.patch b/toolchain/gcc/3.4.2/300-pr17976.patch new file mode 100644 index 0000000000..78bb3559ff --- /dev/null +++ b/toolchain/gcc/3.4.2/300-pr17976.patch @@ -0,0 +1,106 @@ +From: Mark Mitchell +Sender: gcc-patches-owner@gcc.gnu.org +To: gcc-patches@gcc.gnu.org +Subject: C++ PATCH: PR 17976 +Date: Thu, 14 Oct 2004 21:24:41 -0700 + + +This was a case where we generated multiple destructor calls for the +same global variable, in the (probably rare) situation that an +"extern" declaration followed the definition. + +Tested on i686-pc-linux-gnu, applied on the mainline and on the 3.4 +branch. + +-- +Mark Mitchell +CodeSourcery, LLC +mark@codesourcery.com + +# DP: 2004-10-14 Mark Mitchell +# DP: +# DP: PR c++/17976 +# DP: * decl.c (cp_finish_decl): Do not call expand_static_init more +# DP: than once for a single variable. +# DP: +# DP: 2004-10-14 Mark Mitchell +# DP: +# DP: PR c++/17976 +# DP: * g++.dg/init/dtor3.C: New test. + +Index: testsuite/g++.dg/init/dtor3.C +=================================================================== +RCS file: testsuite/g++.dg/init/dtor3.C +diff -N testsuite/g++.dg/init/dtor3.C +*** /dev/null 1 Jan 1970 00:00:00 -0000 +--- gcc/gcc/testsuite/g++.dg/init/dtor3.C 15 Oct 2004 04:02:22 -0000 +*************** +*** 0 **** +--- 1,21 ---- ++ // PR c++/17976 ++ // { dg-do run } ++ ++ extern "C" void abort(); ++ struct A ++ { ++ static int i; ++ A(){} ++ ~A(){i++;if(i>1)abort();} ++ }; ++ ++ int A::i = 0; ++ ++ A a; ++ extern A a; ++ ++ int main() ++ { ++ return 0; ++ } ++ +=================================================================== +RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v +retrieving revision 1.1174.2.26 +retrieving revision 1.1174.2.27 +diff -u -r1.1174.2.26 -r1.1174.2.27 +--- gcc/gcc/cp/decl.c 2004/10/10 21:54:59 1.1174.2.26 ++++ gcc/gcc/cp/decl.c 2004/10/15 04:23:46 1.1174.2.27 +@@ -4778,6 +4778,7 @@ + tree cleanup; + const char *asmspec = NULL; + int was_readonly = 0; ++ bool var_definition_p = false; + + if (decl == error_mark_node) + return; +@@ -4930,6 +4931,11 @@ + /* Remember that the initialization for this variable has + taken place. */ + DECL_INITIALIZED_P (decl) = 1; ++ /* This declaration is the definition of this variable, ++ unless we are initializing a static data member within ++ the class specifier. */ ++ if (!DECL_EXTERNAL (decl)) ++ var_definition_p = true; + } + /* If the variable has an array type, lay out the type, even if + there is no initializer. It is valid to index through the +@@ -5004,8 +5010,16 @@ + initialize_local_var (decl, init); + } + +- if (TREE_STATIC (decl)) +- expand_static_init (decl, init); ++ /* If a variable is defined, and then a subsequent ++ definintion with external linkage is encountered, we will ++ get here twice for the same variable. We want to avoid ++ calling expand_static_init more than once. For variables ++ that are not static data members, we can call ++ expand_static_init only when we actually process the ++ initializer. It is not legal to redeclare a static data ++ member, so this issue does not arise in that case. */ ++ if (var_definition_p && TREE_STATIC (decl)) ++ expand_static_init (decl, init); + } + finish_end0: + -- 2.30.2