summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-13 07:56:10 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-13 07:56:10 +0000
commitf6c6ebd21cb2a0d4a2ab9cdbf56ea39c1ea161e9 (patch)
tree80ec84a7d3e7840c51bb7eb1a7bd13b67b70afe6 /gcc
parent018ef8b85510566d031e3b6cec1709d41221da87 (diff)
downloadgcc-f6c6ebd21cb2a0d4a2ab9cdbf56ea39c1ea161e9.tar.gz
PR c++/25331
* gcc.dg/compat/struct-layout-1_generate.c (subfield): Don't put atal* and atpaal* attributes on array elements. (generate_fields): Revert 2005-10-07 and 2005-10-11 changes. * g++.dg/compat/struct-layout-1_generate.c (subfield): Don't put atal* and atpaal* attributes on array elements. (generate_fields): Don't prevent atal* attribute on ETYPE_ARRAY. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108460 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c54
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c54
3 files changed, 76 insertions, 42 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2bd0541e453..e71e05ee6d0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2005-12-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/25331
+ * gcc.dg/compat/struct-layout-1_generate.c (subfield): Don't
+ put atal* and atpaal* attributes on array elements.
+ (generate_fields): Revert 2005-10-07 and 2005-10-11 changes.
+ * g++.dg/compat/struct-layout-1_generate.c (subfield): Don't
+ put atal* and atpaal* attributes on array elements.
+ (generate_fields): Don't prevent atal* attribute on ETYPE_ARRAY.
+
2005-12-13 Carlos O'Donell <carlos@codesourcery.com>
* gcc.dg/single-precision-constant.c: New test.
diff --git a/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c b/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c
index 2951638de80..da915c7cb8f 100644
--- a/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c
+++ b/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c
@@ -609,6 +609,13 @@ subfield (struct entry *e, char *letter)
snprintf (buf, 20, "%c[]", *letter);
else
snprintf (buf, 20, "%c[%d]", *letter, e[0].arr_len);
+ /* If this is an array type, do not put aligned attributes on
+ elements. Aligning elements to a value greater than their
+ size will result in a compiler error. */
+ if (type == 1
+ && ((strncmp (e[0].attrib, "atal", 4) == 0)
+ || strncmp (e[0].attrib, "atpaal", 6) == 0))
+ type = 2;
}
else
{
@@ -665,18 +672,32 @@ subfield (struct entry *e, char *letter)
}
++*letter;
if (e[0].attrib)
- switch (generate_random () % 3)
- {
- case 0:
- fprintf (outfile, "%s %s %s;", e[0].attrib, e[0].type->name, buf);
- break;
- case 1:
- fprintf (outfile, "%s %s %s;", e[0].type->name, e[0].attrib, buf);
- break;
- case 2:
- fprintf (outfile, "%s %s %s;", e[0].type->name, buf, e[0].attrib);
- break;
- }
+ {
+ /* If this is an array type, do not put aligned attributes on
+ elements. Aligning elements to a value greater than their
+ size will result in a compiler error. */
+ if (e[0].etype == ETYPE_ARRAY
+ && ((strncmp (e[0].attrib, "atal", 4) == 0)
+ || strncmp (e[0].attrib, "atpaal", 6) == 0))
+ type = 2;
+ else
+ type = generate_random () % 3;
+ switch (type)
+ {
+ case 0:
+ fprintf (outfile, "%s %s %s;", e[0].attrib, e[0].type->name,
+ buf);
+ break;
+ case 1:
+ fprintf (outfile, "%s %s %s;", e[0].type->name, e[0].attrib,
+ buf);
+ break;
+ case 2:
+ fprintf (outfile, "%s %s %s;", e[0].type->name, buf,
+ e[0].attrib);
+ break;
+ }
+ }
else
fprintf (outfile, "%s %s;", e[0].type->name, buf);
return 1;
@@ -1297,15 +1318,6 @@ generate_fields (enum FEATURE features, struct entry *e, struct entry *parent,
|| (e[n].type >= &aligned_bitfld_types[0]
&& e[n].type < &aligned_bitfld_types[n_aligned_bitfld_types])))
e[n].attrib = NULL;
-
- /* If this is an array type, do not put aligned attributes on
- elements. Aligning elements to a value greater than their
- size will result in a compiler error. */
-
- if ((e[n].etype == ETYPE_ARRAY)
- && e[n].attrib != NULL
- && (strncmp (e[n].attrib, "atal", 4) == 0))
- e[n].attrib = NULL;
}
}
}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c
index 2f69575cb72..cca2954c448 100644
--- a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c
+++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c
@@ -789,6 +789,13 @@ subfield (struct entry *e, char *letter)
snprintf (buf, 20, "%c[]", *letter);
else
snprintf (buf, 20, "%c[%d]", *letter, e[0].arr_len);
+ /* If this is an array type, do not put aligned attributes on
+ elements. Aligning elements to a value greater than their
+ size will result in a compiler error. */
+ if (type == 1
+ && ((strncmp (e[0].attrib, "atal", 4) == 0)
+ || strncmp (e[0].attrib, "atpaal", 6) == 0))
+ type = 2;
}
else
{
@@ -845,18 +852,32 @@ subfield (struct entry *e, char *letter)
}
++*letter;
if (e[0].attrib)
- switch (generate_random () % 3)
- {
- case 0:
- fprintf (outfile, "%s %s %s;", e[0].attrib, e[0].type->name, buf);
- break;
- case 1:
- fprintf (outfile, "%s %s %s;", e[0].type->name, e[0].attrib, buf);
- break;
- case 2:
- fprintf (outfile, "%s %s %s;", e[0].type->name, buf, e[0].attrib);
- break;
- }
+ {
+ /* If this is an array type, do not put aligned attributes on
+ elements. Aligning elements to a value greater than their
+ size will result in a compiler error. */
+ if (e[0].etype == ETYPE_ARRAY
+ && ((strncmp (e[0].attrib, "atal", 4) == 0)
+ || strncmp (e[0].attrib, "atpaal", 6) == 0))
+ type = 2;
+ else
+ type = generate_random () % 3;
+ switch (type)
+ {
+ case 0:
+ fprintf (outfile, "%s %s %s;", e[0].attrib, e[0].type->name,
+ buf);
+ break;
+ case 1:
+ fprintf (outfile, "%s %s %s;", e[0].type->name, e[0].attrib,
+ buf);
+ break;
+ case 2:
+ fprintf (outfile, "%s %s %s;", e[0].type->name, buf,
+ e[0].attrib);
+ break;
+ }
+ }
else
fprintf (outfile, "%s %s;", e[0].type->name, buf);
return 1;
@@ -1746,15 +1767,6 @@ generate_fields (enum FEATURE features, struct entry *e, struct entry *parent,
|| (e[n].type >= &aligned_bitfld_types[0]
&& e[n].type < &aligned_bitfld_types[n_aligned_bitfld_types])))
e[n].attrib = NULL;
-
- /* If this is an array type, do not put aligned attributes on
- elements. Aligning elements to a value greater than their
- size will result in a compiler error. */
-
- if ((e[n].etype == ETYPE_ARRAY)
- && e[n].attrib != NULL
- && (strncmp (e[n].attrib, "atal", 4) == 0))
- e[n].attrib = NULL;
}
}
}