This commit is contained in:
Jakub Jelinek 2007-08-21 19:33:58 +00:00
parent 353b489040
commit 34b340a5bb
7 changed files with 291 additions and 78 deletions

View File

@ -1 +1 @@
gcc-4.1.2-20070816.tar.bz2
gcc-4.1.2-20070821.tar.bz2

34
gcc41-ppc-tramp.patch Normal file
View File

@ -0,0 +1,34 @@
2007-08-20 Jakub Jelinek <jakub@redhat.com>
* config/rs6000/tramp.asm: Include config.h.
Check __PIC__ or __pic__ macro instead of SHARED.
--- gcc/config/rs6000/tramp.asm.jj 2006-10-05 00:28:33.000000000 +0200
+++ gcc/config/rs6000/tramp.asm 2007-08-20 23:20:52.000000000 +0200
@@ -1,6 +1,6 @@
/* Special support for trampolines
*
- * Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
+ * Copyright (C) 1996, 1997, 2000, 2007 Free Software Foundation, Inc.
* Written By Michael Meissner
*
* This file is free software; you can redistribute it and/or modify it
@@ -37,7 +37,8 @@
.file "tramp.asm"
.section ".text"
- #include "ppc-asm.h"
+#include "ppc-asm.h"
+#include "config.h"
#ifndef __powerpc64__
.type trampoline_initial,@object
@@ -105,7 +106,7 @@ FUNC_START(__trampoline_setup)
blr
.Labort:
-#if defined SHARED && defined HAVE_AS_REL16
+#if (defined __PIC__ || defined __pic__) && defined HAVE_AS_REL16
bcl 20,31,1f
1: mflr r30
addis r30,r30,_GLOBAL_OFFSET_TABLE_-1b@ha

138
gcc41-pr32912.patch Normal file
View File

@ -0,0 +1,138 @@
2007-08-20 Jakub Jelinek <jakub@redhat.com>
PR middle-end/32912
* fold-const.c (fold_binary): Only optimize X | ~X and X ^ ~X for
integral types.
* gcc.dg/pr32912-1.c: New test.
* gcc.dg/pr32912-2.c: New test.
--- gcc/fold-const.c.jj 2007-08-13 15:11:18.000000000 +0200
+++ gcc/fold-const.c 2007-08-20 15:49:05.000000000 +0200
@@ -8079,6 +8079,7 @@ fold_binary (enum tree_code code, tree t
/* ~X | X is -1. */
if (TREE_CODE (arg0) == BIT_NOT_EXPR
+ && INTEGRAL_TYPE_P (TREE_TYPE (arg1))
&& operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0))
{
t1 = build_int_cst (type, -1);
@@ -8088,6 +8089,7 @@ fold_binary (enum tree_code code, tree t
/* X | ~X is -1. */
if (TREE_CODE (arg1) == BIT_NOT_EXPR
+ && INTEGRAL_TYPE_P (TREE_TYPE (arg0))
&& operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
{
t1 = build_int_cst (type, -1);
@@ -8175,6 +8177,7 @@ fold_binary (enum tree_code code, tree t
/* ~X ^ X is -1. */
if (TREE_CODE (arg0) == BIT_NOT_EXPR
+ && INTEGRAL_TYPE_P (TREE_TYPE (arg1))
&& operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0))
{
t1 = build_int_cst (type, -1);
@@ -8184,6 +8187,7 @@ fold_binary (enum tree_code code, tree t
/* X ^ ~X is -1. */
if (TREE_CODE (arg1) == BIT_NOT_EXPR
+ && INTEGRAL_TYPE_P (TREE_TYPE (arg0))
&& operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
{
t1 = build_int_cst (type, -1);
--- gcc/testsuite/gcc.dg/pr32912-1.c.jj 2007-08-20 14:43:05.000000000 +0200
+++ gcc/testsuite/gcc.dg/pr32912-1.c 2007-08-20 14:43:23.000000000 +0200
@@ -0,0 +1,44 @@
+/* PR middle-end/32912 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+typedef int __m128i __attribute__ ((__vector_size__ (16)));
+
+__m128i a, b, c, d, e, f;
+
+void
+foo (__m128i x)
+{
+ a = x ^ ~x;
+ b = ~x ^ x;
+ c = x | ~x;
+ d = ~x | x;
+ e = x & ~x;
+ f = ~x & x;
+}
+
+int
+main (void)
+{
+ union { __m128i v; int i[sizeof (__m128i) / sizeof (int)]; } u;
+ int i;
+
+ for (i = 0; i < sizeof (u.i) / sizeof (u.i[0]); i++)
+ u.i[i] = i * 49 - 36;
+ foo (u.v);
+#define check(x, val) \
+ u.v = (x); \
+ for (i = 0; i < sizeof (u.i) / sizeof (u.i[0]); i++) \
+ if (u.i[i] != (val)) \
+ abort ()
+
+ check (a, ~0);
+ check (b, ~0);
+ check (c, ~0);
+ check (d, ~0);
+ check (e, 0);
+ check (f, 0);
+ return 0;
+}
--- gcc/testsuite/gcc.dg/pr32912-2.c.jj 2007-08-20 15:58:47.000000000 +0200
+++ gcc/testsuite/gcc.dg/pr32912-2.c 2007-08-20 15:55:32.000000000 +0200
@@ -0,0 +1,45 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+typedef int __m128i __attribute__ ((__vector_size__ (16)));
+
+__m128i a, b, c, d, e, f;
+
+__m128i
+foo (void)
+{
+ __m128i x = { 0x11111111, 0x22222222, 0x44444444 };
+ return x;
+}
+
+__m128i
+bar (void)
+{
+ __m128i x = { 0x11111111, 0x22222222, 0x44444444 };
+ return ~x;
+}
+
+int
+main (void)
+{
+ union { __m128i v; int i[sizeof (__m128i) / sizeof (int)]; } u, v;
+ int i;
+
+ u.v = foo ();
+ v.v = bar ();
+ for (i = 0; i < sizeof (u.i) / sizeof (u.i[0]); i++)
+ {
+ if (u.i[i] != ~v.i[i])
+ abort ();
+ if (i < 3)
+ {
+ if (u.i[i] != (0x11111111 << i))
+ abort ();
+ }
+ else if (u.i[i])
+ abort ();
+ }
+ return 0;
+}

View File

@ -1,72 +0,0 @@
2007-08-13 Jakub Jelinek <jakub@redhat.com>
PR c++/32992
* typeck.c (check_return_expr): Don't NRV optimize vars in
anonymous unions.
* decl.c (finish_function): Comment fix.
* g++.dg/opt/nrv14.C: New test.
--- gcc/cp/typeck.c.jj 2007-08-13 15:10:19.000000000 +0200
+++ gcc/cp/typeck.c 2007-08-13 18:00:15.000000000 +0200
@@ -6446,6 +6446,7 @@ check_return_expr (tree retval, bool *no
&& TREE_CODE (retval) == VAR_DECL
&& DECL_CONTEXT (retval) == current_function_decl
&& ! TREE_STATIC (retval)
+ && ! DECL_HAS_VALUE_EXPR_P (retval)
&& (DECL_ALIGN (retval)
>= DECL_ALIGN (DECL_RESULT (current_function_decl)))
&& same_type_p ((TYPE_MAIN_VARIANT
--- gcc/cp/decl.c.jj 2007-08-13 15:10:19.000000000 +0200
+++ gcc/cp/decl.c 2007-08-13 18:09:33.000000000 +0200
@@ -11566,7 +11566,7 @@ finish_function (int flags)
gcc_assert (stmts_are_full_exprs_p ());
/* Set up the named return value optimization, if we can. Candidate
- variables are selected in check_return_value. */
+ variables are selected in check_return_expr. */
if (current_function_return_value)
{
tree r = current_function_return_value;
--- gcc/testsuite/g++.dg/opt/nrv14.C.jj 2007-08-13 18:07:09.000000000 +0200
+++ gcc/testsuite/g++.dg/opt/nrv14.C 2007-08-13 18:07:46.000000000 +0200
@@ -0,0 +1,39 @@
+// PR c++/32992
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort (void);
+
+struct A
+{
+ long int a1;
+ long int a2;
+ long int a3;
+};
+
+struct B
+{
+ long int f[3];
+ operator A ()
+ {
+ union
+ {
+ long int t[3];
+ A a;
+ };
+ for (int i = 0; i < 3; i++)
+ t[i] = f[i];
+ return a;
+ }
+};
+
+int
+main ()
+{
+ B b = { {1, 3, 5} };
+ A a = b;
+
+ if (a.a1 != b.f[0] || a.a2 != b.f[1] || a.a3 != b.f[2])
+ abort ();
+ return 0;
+}

89
gcc41-rh253102.patch Normal file
View File

@ -0,0 +1,89 @@
2007-08-17 Jakub Jelinek <jakub@redhat.com>
* decl.c (variable_decl): Don't share charlen structs if
length == NULL.
* trans-decl.c (create_function_arglist): Assert
f->sym->ts.cl->backend_decl is NULL instead of unsharing
charlen struct here.
* gfortran.dg/assumed_charlen_sharing.f90: New test.
--- gcc/fortran/decl.c.jj 2007-02-20 22:38:20.000000000 +0100
+++ gcc/fortran/decl.c 2007-08-21 20:50:33.000000000 +0200
@@ -1086,10 +1086,11 @@ variable_decl (int elem)
break;
/* Non-constant lengths need to be copied after the first
- element. */
+ element. Also copy assumed lengths. */
case MATCH_NO:
- if (elem > 1 && current_ts.cl->length
- && current_ts.cl->length->expr_type != EXPR_CONSTANT)
+ if (elem > 1
+ && (current_ts.cl->length == NULL
+ || current_ts.cl->length->expr_type != EXPR_CONSTANT))
{
cl = gfc_get_charlen ();
cl->next = gfc_current_ns->cl_list;
--- gcc/fortran/trans-decl.c.jj 2007-03-12 08:28:13.000000000 +0100
+++ gcc/fortran/trans-decl.c 2007-08-21 20:50:33.000000000 +0200
@@ -1417,25 +1417,8 @@ create_function_arglist (gfc_symbol * sy
if (!f->sym->ts.cl->length)
{
TREE_USED (length) = 1;
- if (!f->sym->ts.cl->backend_decl)
- f->sym->ts.cl->backend_decl = length;
- else
- {
- /* there is already another variable using this
- gfc_charlen node, build a new one for this variable
- and chain it into the list of gfc_charlens.
- This happens for e.g. in the case
- CHARACTER(*)::c1,c2
- since CHARACTER declarations on the same line share
- the same gfc_charlen node. */
- gfc_charlen *cl;
-
- cl = gfc_get_charlen ();
- cl->backend_decl = length;
- cl->next = f->sym->ts.cl->next;
- f->sym->ts.cl->next = cl;
- f->sym->ts.cl = cl;
- }
+ gcc_assert (!f->sym->ts.cl->backend_decl);
+ f->sym->ts.cl->backend_decl = length;
}
hidden_typelist = TREE_CHAIN (hidden_typelist);
--- gcc/testsuite/gfortran.dg/assumed_charlen_sharing.f90.jj 2007-08-21 08:29:57.000000000 +0200
+++ gcc/testsuite/gfortran.dg/assumed_charlen_sharing.f90 2007-08-21 08:29:57.000000000 +0200
@@ -0,0 +1,29 @@
+! This testcase was miscompiled, because ts.cl
+! in function bar was initially shared between both
+! dummy arguments. Although it was later unshared,
+! all expressions which copied ts.cl from bar2
+! before that used incorrectly bar1's length
+! instead of bar2.
+! { dg-do run }
+
+subroutine foo (foo1, foo2)
+ implicit none
+ integer, intent(in) :: foo2
+ character(*), intent(in) :: foo1(foo2)
+end subroutine foo
+
+subroutine bar (bar1, bar2)
+ implicit none
+ character(*), intent(in) :: bar1, bar2
+
+ call foo ((/ bar2 /), 1)
+end subroutine bar
+
+program test
+ character(80) :: str1
+ character(5) :: str2
+
+ str1 = 'String'
+ str2 = 'Strng'
+ call bar (str2, str1)
+end program test

View File

@ -1,6 +1,6 @@
%define DATE 20070816
%define DATE 20070821
%define gcc_version 4.1.2
%define gcc_release 18
%define gcc_release 19
%define _unpackaged_files_terminate_build 0
%define multilib_64_archs sparc64 ppc64 s390x x86_64
%define include_gappletviewer 1
@ -140,8 +140,10 @@ Patch23: gcc41-pr28690.patch
Patch24: gcc41-rh247256.patch
Patch25: gcc41-pr22244.patch
Patch26: gcc41-pr32678.patch
Patch27: gcc41-pr32992.patch
Patch27: gcc41-pr32912.patch
Patch28: gcc41-sparc-niagara.patch
Patch29: gcc41-ppc-tramp.patch
Patch30: gcc41-rh253102.patch
# On ARM EABI systems, we do want -gnueabi to be part of the
# target triple.
@ -451,8 +453,10 @@ which are required to run programs compiled with the GNAT.
%patch24 -p0 -b .rh247256~
%patch25 -p0 -b .pr22244~
%patch26 -p0 -b .pr32678~
%patch27 -p0 -b .pr32992~
%patch27 -p0 -b .pr32912~
%patch28 -p0 -b .sparc-niagara~
%patch29 -p0 -b .ppc-tramp~
%patch30 -p0 -b .rh253102~
sed -i -e 's/4\.1\.3/4.1.2/' gcc/BASE-VER gcc/version.c
sed -i -e 's/" (Red Hat[^)]*)"/" (Red Hat %{version}-%{gcc_release})"/' gcc/version.c
@ -745,6 +749,17 @@ EOF
fi
done
# Nuke bits/stdc++.h.gch dirs
# 1) there is no bits/stdc++.h header installed, so when gch file can't be
# used, compilation fails
# 2) sometimes it is hard to match the exact options used for building
# libstdc++-v3 or they aren't desirable
# 3) there are multilib issues, conflicts etc. with this
# 4) it is huge
# People can always precompile on their own whatever they want, but
# shipping this for everybody is unnecessary.
rm -rf $RPM_BUILD_ROOT%{_prefix}/include/c++/%{gcc_version}/%{gcc_target_platform}/bits/stdc++.h.gch
%ifarch sparc sparc64
ln -f $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target_platform}-gcc \
$RPM_BUILD_ROOT%{_prefix}/bin/sparc-%{_vendor}-%{_target_os}-gcc
@ -1576,6 +1591,15 @@ fi
%doc rpm.doc/changelogs/libmudflap/ChangeLog*
%changelog
* Tue Aug 21 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-19
- update from gcc-4_1-branch (-r127528:127672)
- PR c++/32112
- fix ppc32 libgcc.a(tramp.o), so that binaries using trampolines
aren't forced to use bss PLT
- fix a fortran charlen sharing bug (#253102)
- fix ICE with X|~X or X^~X with vectors (PR middle-end/32912)
- nuke bits/stdc++.gch directories from libstdc++-devel (#253304)
* Thu Aug 16 2007 Jakub Jelinek <jakub@redhat.com> 4.1.2-18
- update from gcc-4_1-branch (-r126830:127528)
- PR c++/17763

View File

@ -1 +1 @@
599a243fcc5e34eac99032611e91618b gcc-4.1.2-20070816.tar.bz2
65778706d6b9c029a06fca968a45ab7f gcc-4.1.2-20070821.tar.bz2