rpms/gcc/F-12 gcc44-pr41317.patch, NONE, 1.1 .cvsignore, 1.296, 1.297 gcc.spec, 1.75, 1.76 sources, 1.300, 1.301

Jakub Jelinek jakub at fedoraproject.org
Mon Oct 5 20:25:00 UTC 2009


Author: jakub

Update of /cvs/pkgs/rpms/gcc/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv16520

Modified Files:
	.cvsignore gcc.spec sources 
Added Files:
	gcc44-pr41317.patch 
Log Message:
4.4.1-19.fc12

gcc44-pr41317.patch:
 testsuite/gcc.c-torture/execute/pr41317.c |   28 +++++++++
 tree-ssa-ccp.c                            |   91 +++++++++++-------------------
 2 files changed, 63 insertions(+), 56 deletions(-)

--- NEW FILE gcc44-pr41317.patch ---
2009-09-09  Richard Guenther  <rguenther at suse.de>

	PR middle-end/41317
	* tree-ssa-ccp.c (maybe_fold_offset_to_component_ref): Remove
	code dealing with plain pointer bases.
	(maybe_fold_offset_to_reference): Likewise.
	(maybe_fold_stmt_addition): Adjust.

	* gcc.c-torture/execute/pr41317.c: New testcase.

--- gcc/tree-ssa-ccp.c.jj	2009-04-22 23:58:31.000000000 +0200
+++ gcc/tree-ssa-ccp.c	2009-10-05 16:50:00.000000000 +0200
@@ -1727,7 +1727,7 @@ maybe_fold_offset_to_array_ref (tree bas
 
 static tree
 maybe_fold_offset_to_component_ref (tree record_type, tree base, tree offset,
-				    tree orig_type, bool base_is_ptr)
+				    tree orig_type)
 {
   tree f, t, field_type, tail_array_field, field_offset;
   tree ret;
@@ -1779,8 +1779,6 @@ maybe_fold_offset_to_component_ref (tree
       if (cmp == 0
 	  && useless_type_conversion_p (orig_type, field_type))
 	{
-	  if (base_is_ptr)
-	    base = build1 (INDIRECT_REF, record_type, base);
 	  t = build3 (COMPONENT_REF, field_type, base, f, NULL_TREE);
 	  return t;
 	}
@@ -1805,11 +1803,7 @@ maybe_fold_offset_to_component_ref (tree
 
       /* If we matched, then set offset to the displacement into
 	 this field.  */
-      if (base_is_ptr)
-	new_base = build1 (INDIRECT_REF, record_type, base);
-      else
-	new_base = base;
-      new_base = build3 (COMPONENT_REF, field_type, new_base, f, NULL_TREE);
+      new_base = build3 (COMPONENT_REF, field_type, base, f, NULL_TREE);
 
       /* Recurse to possibly find the match.  */
       ret = maybe_fold_offset_to_array_ref (new_base, t, orig_type,
@@ -1817,7 +1811,7 @@ maybe_fold_offset_to_component_ref (tree
       if (ret)
 	return ret;
       ret = maybe_fold_offset_to_component_ref (field_type, new_base, t,
-						orig_type, false);
+						orig_type);
       if (ret)
 	return ret;
     }
@@ -1831,8 +1825,6 @@ maybe_fold_offset_to_component_ref (tree
 
   /* If we get here, we've got an aggregate field, and a possibly 
      nonzero offset into them.  Recurse and hope for a valid match.  */
-  if (base_is_ptr)
-    base = build1 (INDIRECT_REF, record_type, base);
   base = build3 (COMPONENT_REF, field_type, base, f, NULL_TREE);
 
   t = maybe_fold_offset_to_array_ref (base, offset, orig_type,
@@ -1840,7 +1832,7 @@ maybe_fold_offset_to_component_ref (tree
   if (t)
     return t;
   return maybe_fold_offset_to_component_ref (field_type, base, offset,
-					     orig_type, false);
+					     orig_type);
 }
 
 /* Attempt to express (ORIG_TYPE)BASE+OFFSET as BASE->field_of_orig_type
@@ -1854,57 +1846,44 @@ maybe_fold_offset_to_reference (tree bas
 {
   tree ret;
   tree type;
-  bool base_is_ptr = true;
 
   STRIP_NOPS (base);
-  if (TREE_CODE (base) == ADDR_EXPR)
-    {
-      base_is_ptr = false;
+  if (TREE_CODE (base) != ADDR_EXPR)
+    return NULL_TREE;
 
-      base = TREE_OPERAND (base, 0);
+  base = TREE_OPERAND (base, 0);
 
-      /* Handle case where existing COMPONENT_REF pick e.g. wrong field of union,
-	 so it needs to be removed and new COMPONENT_REF constructed.
-	 The wrong COMPONENT_REF are often constructed by folding the
-	 (type *)&object within the expression (type *)&object+offset  */
-      if (handled_component_p (base))
+  /* Handle case where existing COMPONENT_REF pick e.g. wrong field of union,
+     so it needs to be removed and new COMPONENT_REF constructed.
+     The wrong COMPONENT_REF are often constructed by folding the
+     (type *)&object within the expression (type *)&object+offset  */
+  if (handled_component_p (base))
+    {
+      HOST_WIDE_INT sub_offset, size, maxsize;
+      tree newbase;
+      newbase = get_ref_base_and_extent (base, &sub_offset,
+					 &size, &maxsize);
+      gcc_assert (newbase);
+      if (size == maxsize
+	  && size != -1
+	  && !(sub_offset & (BITS_PER_UNIT - 1)))
 	{
-          HOST_WIDE_INT sub_offset, size, maxsize;
-	  tree newbase;
-	  newbase = get_ref_base_and_extent (base, &sub_offset,
-					     &size, &maxsize);
-	  gcc_assert (newbase);
-	  if (size == maxsize
-	      && size != -1
-	      && !(sub_offset & (BITS_PER_UNIT - 1)))
-	    {
-	      base = newbase;
-	      if (sub_offset)
-		offset = int_const_binop (PLUS_EXPR, offset,
-					  build_int_cst (TREE_TYPE (offset),
-					  sub_offset / BITS_PER_UNIT), 1);
-	    }
+	  base = newbase;
+	  if (sub_offset)
+	    offset = int_const_binop (PLUS_EXPR, offset,
+				      build_int_cst (TREE_TYPE (offset),
+					     sub_offset / BITS_PER_UNIT), 1);
 	}
-      if (useless_type_conversion_p (orig_type, TREE_TYPE (base))
-	  && integer_zerop (offset))
-	return base;
-      type = TREE_TYPE (base);
     }
-  else
-    {
-      base_is_ptr = true;
-      if (!POINTER_TYPE_P (TREE_TYPE (base)))
-	return NULL_TREE;
-      type = TREE_TYPE (TREE_TYPE (base));
-    }
-  ret = maybe_fold_offset_to_component_ref (type, base, offset,
-					    orig_type, base_is_ptr);
+  if (useless_type_conversion_p (orig_type, TREE_TYPE (base))
+      && integer_zerop (offset))
+    return base;
+  type = TREE_TYPE (base);
+
+  ret = maybe_fold_offset_to_component_ref (type, base, offset, orig_type);
   if (!ret)
-    {
-      if (base_is_ptr)
-	base = build1 (INDIRECT_REF, type, base);
-      ret = maybe_fold_offset_to_array_ref (base, offset, orig_type, true);
-    }
+    ret = maybe_fold_offset_to_array_ref (base, offset, orig_type, true);
+
   return ret;
 }
 
@@ -2143,7 +2122,7 @@ maybe_fold_stmt_addition (tree res_type,
   t = maybe_fold_offset_to_array_ref (op0, op1, ptd_type, true);
   if (!t)
     t = maybe_fold_offset_to_component_ref (TREE_TYPE (op0), op0, op1,
-					    ptd_type, false);
+					    ptd_type);
   if (t)
     t = build1 (ADDR_EXPR, res_type, t);
 
--- gcc/testsuite/gcc.c-torture/execute/pr41317.c.jj	2009-10-05 16:18:54.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/execute/pr41317.c	2009-10-05 16:18:54.000000000 +0200
@@ -0,0 +1,28 @@
+extern void abort (void);
+
+struct A
+{
+  int i;
+};
+struct B
+{
+  struct A a;
+  int j;
+};
+
+static void
+foo (struct B *p)
+{
+  ((struct A *)p)->i = 1;
+}
+
+int main()
+{
+  struct A a;
+  a.i = 0;
+  foo ((struct B *)&a);
+  if (a.i != 1)
+    abort ();
+  return 0;
+}
+


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/gcc/F-12/.cvsignore,v
retrieving revision 1.296
retrieving revision 1.297
diff -u -p -r1.296 -r1.297
--- .cvsignore	1 Oct 2009 08:19:32 -0000	1.296
+++ .cvsignore	5 Oct 2009 20:24:56 -0000	1.297
@@ -1,2 +1,2 @@
 fastjar-0.97.tar.gz
-gcc-4.4.1-20091001.tar.bz2
+gcc-4.4.1-20091005.tar.bz2


Index: gcc.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gcc/F-12/gcc.spec,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -p -r1.75 -r1.76
--- gcc.spec	1 Oct 2009 08:19:32 -0000	1.75
+++ gcc.spec	5 Oct 2009 20:24:57 -0000	1.76
@@ -1,9 +1,9 @@
-%global DATE 20091001
-%global SVNREV 152364
+%global DATE 20091005
+%global SVNREV 152471
 %global gcc_version 4.4.1
 # Note, gcc_release must be integer, if you want to add suffixes to
 # %{release}, append them after %{gcc_release} on Release: line.
-%global gcc_release 18
+%global gcc_release 19
 %global _unpackaged_files_terminate_build 0
 %global multilib_64_archs sparc64 ppc64 s390x x86_64
 %global include_gappletviewer 1
@@ -161,6 +161,7 @@ Patch17: gcc44-pr38757.patch
 Patch18: gcc44-libstdc++-docs.patch
 Patch19: gcc44-ppc64-aixdesc.patch
 Patch20: gcc44-vta-rh521991.patch
+Patch21: gcc44-pr41317.patch
 
 Patch1000: fastjar-0.97-segfault.patch
 
@@ -468,6 +469,7 @@ which are required to compile with the G
 %endif
 %patch19 -p0 -b .ppc64-aixdesc~
 %patch20 -p0 -b .vta-rh521991~
+%patch21 -p0 -b .pr41317~
 
 # This testcase doesn't compile.
 rm libjava/testsuite/libjava.lang/PR35020*
@@ -1837,6 +1839,17 @@ fi
 %doc rpm.doc/changelogs/libmudflap/ChangeLog*
 
 %changelog
+* Mon Oct  5 2009 Jakub Jelinek <jakub at redhat.com> 4.4.1-19
+- update from gcc-4_4-branch
+  - PRs fortran/41479, fortran/41515
+- VTA backports
+  - PRs debug/41353, debug/41404, rtl-optimization/41511
+  - another debug info fix for decls passed by reference (#527057,
+    PR debug/41558)
+  - don't emit DW_AT_name on DW_TAG_const_type (#526970)
+- avoid invalid folding of casts to addresses of first fields
+  (#527121, PR middle-end/41317)
+
 * Thu Oct  1 2009 Jakub Jelinek <jakub at redhat.com> 4.4.1-18
 - update from gcc-4_4-branch
   - PRs ada/41100, target/22093


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/gcc/F-12/sources,v
retrieving revision 1.300
retrieving revision 1.301
diff -u -p -r1.300 -r1.301
--- sources	1 Oct 2009 08:19:33 -0000	1.300
+++ sources	5 Oct 2009 20:24:57 -0000	1.301
@@ -1,2 +1,2 @@
 2659f09c2e43ef8b7d4406321753f1b2  fastjar-0.97.tar.gz
-18fe22db9e055b13b9cc290f6cbbf1fa  gcc-4.4.1-20091001.tar.bz2
+c89041d608f2c9f1711384305660a6ec  gcc-4.4.1-20091005.tar.bz2




More information about the fedora-extras-commits mailing list