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
This commit is contained in:
Richard Henderson 2004-10-13 16:31:23 -07:00 committed by Richard Henderson
parent 32e66afd7f
commit 61f03abaa5
5 changed files with 48 additions and 8 deletions

View File

@ -1,3 +1,13 @@
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

View 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. */

View 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)

View 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 */

View File

@ -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" } */