[PATCH] Minor simplification to c-typeck.c composite_type

rbrown64@csc.com.au rbrown64@csc.com.au
Thu Jul 1 04:24:00 GMT 2004


Patch based on 20040627 snapshot, bootstrapped on powerpc-apple-darwin6.8 --enable-languages=c,c++
with no testsuite regressions on C, but with some on C++ - see below.
This may be an interaction with dejagnu and the stack limits on the platform.
NB According to the testing page dejagnu 1.4.4 is required, but the infrastructure directory has a version from
2001 and the local GNU mirror only has 1.4.3.
Acceptable or try again next snapshot?

Copyright assigned, but no CVS write access.


Configured with: ../gcc-3.5-20040627/configure --enable-languages=c,c++
Thread model: posix
gcc version 3.5.0 20040627 (experimental)

2004-06-30  Rodney Brown  <rbrown64@csc.com.au>

      * c-typeck.c (composite_type, <case ARRAY_TYPE>):
      Simplify code where the new element type is that of an argument.

--- gcc/c-typeck.c.orig Sat Jun 26 15:03:47 2004
+++ gcc/c-typeck.c      Tue Jun 29 17:57:47 2004
@@ -260,26 +260,21 @@ composite_type (tree t1, tree t2)
     case ARRAY_TYPE:
       {
      tree elt = composite_type (TREE_TYPE (t1), TREE_TYPE (t2));

      /* We should not have any type quals on arrays at all.  */
      if (TYPE_QUALS (t1) || TYPE_QUALS (t2))
        abort ();

      /* Save space: see if the result is identical to one of the args.  */
-     if (elt == TREE_TYPE (t1) && TYPE_DOMAIN (t1))
+     if (elt == TREE_TYPE (t1) && (TYPE_DOMAIN (t1) || !TYPE_DOMAIN (t2)))
        return build_type_attribute_variant (t1, attributes);
-     if (elt == TREE_TYPE (t2) && TYPE_DOMAIN (t2))
-       return build_type_attribute_variant (t2, attributes);
-
-     if (elt == TREE_TYPE (t1) && !TYPE_DOMAIN (t2) && !TYPE_DOMAIN (t1))
-       return build_type_attribute_variant (t1, attributes);
-     if (elt == TREE_TYPE (t2) && !TYPE_DOMAIN (t2) && !TYPE_DOMAIN (t1))
+     if (elt == TREE_TYPE (t2) && (TYPE_DOMAIN (t2) || !TYPE_DOMAIN (t1)))
        return build_type_attribute_variant (t2, attributes);

      /* Merge the element types, and have a size if either arg has one.  */
      t1 = build_array_type (elt, TYPE_DOMAIN (TYPE_DOMAIN (t1) ? t1 : t2));
      return build_type_attribute_variant (t1, attributes);
       }

     case FUNCTION_TYPE:
       /* Function types: prefer the one that specified arg types.


diff of new and old version showing only FAILs for the new version.

--- gcc/testsuite/g++.sum     Wed Jun 30 22:34:36 2004
+++ ../gcc-3.5-20040627.obj/gcc/testsuite/g++.sum     Wed Jun 30 14:17:37 2004
@@ -1,2 +1,2 @@
-Test Run By rdb on Wed Jun 30 21:53:26 2004
+Test Run By rdb on Wed Jun 30 13:52:57 2004
 Native configuration is powerpc-apple-darwin6.8
@@ -1155,4 +1155,4 @@
 PASS: g++.dg/ext/lvalue1.C (test for excess errors)
-FAIL: g++.dg/ext/max.C  (test for errors, line 5)
-FAIL: g++.dg/ext/max.C (test for excess errors)
+PASS: g++.dg/ext/max.C  (test for errors, line 5)
+PASS: g++.dg/ext/max.C (test for excess errors)
 PASS: g++.dg/ext/member-attr.C  (test for errors, line 12)
@@ -3379,8 +3379,8 @@
 PASS: g++.old-deja/g++.benjamin/warn01.C (test for excess errors)
-FAIL: g++.old-deja/g++.benjamin/warn02.C  (test for warnings, line 26)
-FAIL: g++.old-deja/g++.benjamin/warn02.C  (test for errors, line 35)
-FAIL: g++.old-deja/g++.benjamin/warn02.C  (test for errors, line 43)
-FAIL: g++.old-deja/g++.benjamin/warn02.C  (test for warnings, line 47)
-FAIL: g++.old-deja/g++.benjamin/warn02.C  (test for warnings, line 48)
-FAIL: g++.old-deja/g++.benjamin/warn02.C (test for excess errors)
+PASS: g++.old-deja/g++.benjamin/warn02.C  (test for warnings, line 26)
+PASS: g++.old-deja/g++.benjamin/warn02.C  (test for errors, line 35)
+PASS: g++.old-deja/g++.benjamin/warn02.C  (test for errors, line 43)
+PASS: g++.old-deja/g++.benjamin/warn02.C  (test for warnings, line 47)
+PASS: g++.old-deja/g++.benjamin/warn02.C  (test for warnings, line 48)
+PASS: g++.old-deja/g++.benjamin/warn02.C (test for excess errors)
 PASS: g++.old-deja/g++.benjamin/warn03.C (test for excess errors)
@@ -3862,4 +3862,4 @@
 PASS: g++.old-deja/g++.brendan/sizeof2.C (test for excess errors)
-FAIL: g++.old-deja/g++.brendan/sizeof3.C  (test for errors, line 12)
-FAIL: g++.old-deja/g++.brendan/sizeof3.C (test for excess errors)
+PASS: g++.old-deja/g++.brendan/sizeof3.C  (test for errors, line 12)
+PASS: g++.old-deja/g++.brendan/sizeof3.C (test for excess errors)
 PASS: g++.old-deja/g++.brendan/sizeof4.C  (test for errors, line 10)
@@ -9969,4 +9969,4 @@

-# of expected passes         9555
-# of unexpected failures     121
+# of expected passes         9541
+# of unexpected failures     135
 # of unexpected successes    1
@@ -9975,3 +9975,3 @@
 # of unsupported tests       89
-/devel/src/gcc-3.5-20040627.obj2/gcc/testsuite/../g++  version 3.5.0 20040627 (experimental)
+/devel/src/gcc-3.5-20040627.obj/gcc/testsuite/../g++  version 3.5.0 20040627 (experimental)




More information about the Gcc-patches mailing list