aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/c-common.c16
-rw-r--r--gcc/config/i386/mm3dnow.h2
-rw-r--r--gcc/crtstuff.c15
-rw-r--r--gcc/testsuite/gcc.dg/attr-mode-1.c13
5 files changed, 48 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8267021..647941c6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,14 @@
2004-10-13 Richard Henderson <rth@redhat.com>
+
+ 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.
+
+2004-10-13 Richard Henderson <rth@redhat.com>
PR debug/13841
* function.c (instantiate_decl): Recurse for CONCAT.
diff --git a/gcc/c-common.c b/gcc/c-common.c
index b2751f3..2e634fa 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. */
diff --git a/gcc/config/i386/mm3dnow.h b/gcc/config/i386/mm3dnow.h
index 7987c0a..1588254 100644
--- a/gcc/config/i386/mm3dnow.h
+++ b/gcc/config/i386/mm3dnow.h
@@ -35,7 +35,7 @@
#include <mmintrin.h>
/* Internal data types for implementing the intrinsics. */
-typedef int __v2sf __attribute__ ((__mode__ (__SF__), __vector_size__ (8)));
+typedef float __v2sf __attribute__ ((__vector_size__ (8)));
static __inline void
_m_femms (void)
diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c
index ecb3dea..22f221b 100644
--- a/gcc/crtstuff.c
+++ b/gcc/crtstuff.c
@@ -455,9 +455,18 @@ STATIC func_ptr __DTOR_END__[1]
#ifdef EH_FRAME_SECTION_NAME
/* Terminate the frame unwind info section with a 4byte 0 as a sentinel;
this would be the 'length' field in a real FDE. */
-STATIC EH_FRAME_SECTION_CONST int __FRAME_END__[]
- __attribute__ ((unused, mode(SI), section(EH_FRAME_SECTION_NAME),
- aligned(4)))
+# if __INT_MAX__ == 2147483647
+typedef int int32;
+# elif __LONG_MAX__ == 2147483647
+typedef long int32;
+# elif __SHRT_MAX__ == 2147483647
+typedef short int32;
+# else
+# error "Missing a 4 byte integer"
+# endif
+STATIC EH_FRAME_SECTION_CONST int32 __FRAME_END__[]
+ __attribute__ ((unused, section(EH_FRAME_SECTION_NAME),
+ aligned(sizeof(int32))))
= { 0 };
#endif /* EH_FRAME_SECTION_NAME */
diff --git a/gcc/testsuite/gcc.dg/attr-mode-1.c b/gcc/testsuite/gcc.dg/attr-mode-1.c
new file mode 100644
index 0000000..e60d01b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-mode-1.c
@@ -0,0 +1,13 @@
+/* PR c/17384 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+typedef struct __attribute__((mode(SI))) {
+ unsigned INT0 :1,
+ RES0 :1,
+ :6,
+ INT1 :1,
+ RES1 :1,
+ :6,
+ :16;
+} MCR; /* { dg-error "inappropriate type" } */