OSDN Git Service

PR c/17384
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Oct 2004 23:31:23 +0000 (23:31 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Oct 2004 23:31:23 +0000 (23:31 +0000)
        * 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89009 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-common.c
gcc/config/i386/mm3dnow.h
gcc/crtstuff.c
gcc/testsuite/gcc.dg/attr-mode-1.c [new file with mode: 0644]

index 8267021..647941c 100644 (file)
@@ -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.
index b2751f3..2e634fa 100644 (file)
@@ -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.  */
index 7987c0a..1588254 100644 (file)
@@ -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)
index ecb3dea..22f221b 100644 (file)
@@ -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 (file)
index 0000000..e60d01b
--- /dev/null
@@ -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" } */