summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-10-13 16:31:23 -0700
committerRichard Henderson <rth@gcc.gnu.org>2004-10-13 16:31:23 -0700
commit61f03abaa5aabfabc4aaf73df1a19960f1239a89 (patch)
tree7c3835d567e4f5a0701ce4cfb8a1f2b8d696022d /gcc/c-common.c
parent32e66afd7f82ae62f3232146743d3ab7eec86557 (diff)
downloadgcc-61f03abaa5aabfabc4aaf73df1a19960f1239a89.tar.gz
re PR c/17384 (ICE with mode attribute on structures)
PR c/17384 * c-common.c (handle_mode_attribute): Disallow mode changes that alter the CODE of the top-level type. * crtstuff.c (__FRAME_END__): Remove mode attribute. Find 32-bit integer from internal limits macros. * config/i386/mm3dnow.h (__v2sf): Fix base type. From-SVN: r89009
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index b2751f39226..2e634fae9ba 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -4303,7 +4303,10 @@ handle_mode_attribute (tree *node, tree name, tree args,
else
for (j = 0; j < NUM_MACHINE_MODES; j++)
if (!strcmp (p, GET_MODE_NAME (j)))
- mode = (enum machine_mode) j;
+ {
+ mode = (enum machine_mode) j;
+ break;
+ }
if (mode == VOIDmode)
{
@@ -4363,7 +4366,7 @@ handle_mode_attribute (tree *node, tree name, tree args,
if (typefm == NULL_TREE)
{
- error ("no data type for mode %<%s%>", p);
+ error ("no data type for mode %qs", p);
return NULL_TREE;
}
else if (TREE_CODE (type) == ENUMERAL_TYPE)
@@ -4373,8 +4376,7 @@ handle_mode_attribute (tree *node, tree name, tree args,
this mode for this type. */
if (TREE_CODE (typefm) != INTEGER_TYPE)
{
- error ("cannot use mode %qs for enumeral types",
- GET_MODE_NAME (mode));
+ error ("cannot use mode %qs for enumeral types", p);
return NULL_TREE;
}
@@ -4383,6 +4385,12 @@ handle_mode_attribute (tree *node, tree name, tree args,
TYPE_PRECISION (type) = TYPE_PRECISION (typefm);
typefm = type;
}
+ else if (TREE_CODE (type) != TREE_CODE (typefm))
+ {
+ error ("mode %qs applied to inappropriate type", p);
+ return NULL_TREE;
+ }
+
*node = typefm;
/* No need to layout the type here. The caller should do this. */