diff options
author | Andrew Pinski <apinski@apple.com> | 2004-06-23 20:53:17 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2004-06-23 13:53:17 -0700 |
commit | de46b2fe0dc554f71b61f0bcc8d6afdde2292a6c (patch) | |
tree | 046d79935a5305e2ca08168568b559af903e3f1a | |
parent | 07f266aecd773341be6f62935bcf8a6e935d5528 (diff) | |
download | gcc-de46b2fe0dc554f71b61f0bcc8d6afdde2292a6c.zip gcc-de46b2fe0dc554f71b61f0bcc8d6afdde2292a6c.tar.gz gcc-de46b2fe0dc554f71b61f0bcc8d6afdde2292a6c.tar.bz2 |
c-typeck.c (composite_type, [...]): Abort if we have type qualifiers at all.
2004-06-23 Andrew Pinski <apinski@apple.com>
* c-typeck.c (composite_type, <case ARRAY_TYPE>): Abort if we have
type qualifiers at all.
If both of the type domains are null and the new element type is
the same as one of the, return the one which the element type.
matches.
Do not call qualify_type on the new type.
2004-06-23 Andrew Pinski <apinski@apple.com>
* gcc.dg/c90-array-quals-2.c: New test.
From-SVN: r83567
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/c-typeck.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c90-array-quals-2.c | 3 |
4 files changed, 28 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3c4f663..d1e5799 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-06-23 Andrew Pinski <apinski@apple.com> + + * c-typeck.c (composite_type, <case ARRAY_TYPE>): Abort if we have + type qualifiers at all. + If both of the type domains are null and the new element type is + the same as one of the, return the one which the element type. + matches. + Do not call qualify_type on the new type. + 2004-06-23 Ulrich Weigand <uweigand@de.ibm.com> * config/s390/s390.h (DEFAULT_MAIN_RETURN): Remove. diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 6a4e1db..ad6a90a 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -260,15 +260,25 @@ 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)) 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)) + 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)); - t1 = build_type_attribute_variant (t1, attributes); - return qualify_type (t1, t2); + return build_type_attribute_variant (t1, attributes); } case FUNCTION_TYPE: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fd9029a..facc58b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-06-23 Andrew Pinski <apinski@apple.com> + + * gcc.dg/c90-array-quals-2.c: New test. + 2006-06-23 Nitin Yewale <NitinY@KPITCummins.com> * gcc.dg/kpice1.c: New test. diff --git a/gcc/testsuite/gcc.dg/c90-array-quals-2.c b/gcc/testsuite/gcc.dg/c90-array-quals-2.c new file mode 100644 index 0000000..7cb68c8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-array-quals-2.c @@ -0,0 +1,3 @@ +extern const char *const a[]; +extern const char *const a[]; +extern const char *const a[]; |