c-decl.c (finish_enum): Revert part of 2000-01-05 change.
* c-decl.c (finish_enum): Revert part of 2000-01-05 change. * gcc.dg/20010202-1.c: New test. * gcc.dg/991209-1.c: Compile on whole ia32 family, not just i386. From-SVN: r39527
This commit is contained in:
parent
0c952af328
commit
1ada4cd094
@ -1,3 +1,7 @@
|
||||
2001-02-07 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* c-decl.c (finish_enum): Revert part of 2000-01-05 change.
|
||||
|
||||
2001-02-07 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* config/rs6000/aix43.h (CPLUSCPLUS_CPP_SPEC): Define it.
|
||||
|
14
gcc/c-decl.c
14
gcc/c-decl.c
@ -5610,14 +5610,20 @@ finish_enum (enumtype, values, attributes)
|
||||
unsign = (tree_int_cst_sgn (minnode) >= 0);
|
||||
precision = MAX (min_precision (minnode, unsign),
|
||||
min_precision (maxnode, unsign));
|
||||
if (!TYPE_PACKED (enumtype))
|
||||
precision = MAX (precision, TYPE_PRECISION (integer_type_node));
|
||||
if (type_for_size (precision, unsign) == 0)
|
||||
if (TYPE_PACKED (enumtype) || precision > TYPE_PRECISION (integer_type_node))
|
||||
{
|
||||
tree narrowest = type_for_size (precision, unsign);
|
||||
if (narrowest == 0)
|
||||
{
|
||||
warning ("enumeration values exceed range of largest integer");
|
||||
precision = TYPE_PRECISION (long_long_integer_type_node);
|
||||
narrowest = long_long_integer_type_node;
|
||||
}
|
||||
|
||||
precision = TYPE_PRECISION (narrowest);
|
||||
}
|
||||
else
|
||||
precision = TYPE_PRECISION (integer_type_node);
|
||||
|
||||
if (precision == TYPE_PRECISION (integer_type_node))
|
||||
enum_value_type = type_for_size (precision, 0);
|
||||
else
|
||||
|
@ -1,3 +1,8 @@
|
||||
2001-02-07 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* gcc.dg/20010202-1.c: New test.
|
||||
* gcc.dg/991209-1.c: Compile on whole ia32 family, not just i386.
|
||||
|
||||
2001-02-07 Zack Weinberg <zack@wolery.stanford.edu>
|
||||
|
||||
* g++.dg/stdbool-if.C: New test.
|
||||
|
24
gcc/testsuite/gcc.dg/20010202-1.c
Normal file
24
gcc/testsuite/gcc.dg/20010202-1.c
Normal file
@ -0,0 +1,24 @@
|
||||
/* { dg-do compile { target i?86-*-* sparc*-*-* } } */
|
||||
/* { dg-options "-O2" } */
|
||||
|
||||
typedef enum { false, true } __attribute__ ((packed)) boolean;
|
||||
typedef struct {
|
||||
enum {
|
||||
A0 = 0, A1 = 1, A2 = 2
|
||||
} __attribute__((packed)) A:3;
|
||||
enum {
|
||||
B0 = 0, B1 = 1, B2 = 2
|
||||
} __attribute__((packed)) B:3;
|
||||
boolean C:1;
|
||||
boolean D:1;
|
||||
unsigned char :8;
|
||||
} foo;
|
||||
foo x = { A2, B1, false, true };
|
||||
|
||||
int main(void)
|
||||
{
|
||||
if (sizeof (foo) != 2 || __alignof__ (foo) != 1)
|
||||
abort ();
|
||||
|
||||
exit (0);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* { dg-do compile { target i386-*-* } } */
|
||||
/* { dg-do compile { target i?86-*-* } } */
|
||||
|
||||
int foo ()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user