]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/18282 (PR c/17384 patch causes regression from 3.4.2)
authorRichard Henderson <rth@redhat.com>
Thu, 23 Dec 2004 23:50:46 +0000 (15:50 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 23 Dec 2004 23:50:46 +0000 (15:50 -0800)
        PR c/18282
        * c-decl.c (finish_enum): Retain precision acquired from an attribute.

From-SVN: r92576

gcc/ChangeLog
gcc/c-decl.c

index 35808b5b2730337526c3fdbd0ed5501bc1808d86..f825070f231d35d0cbf4998dc7a2015bf0a22716 100644 (file)
@@ -1,3 +1,8 @@
+2004-12-23  Richard Henderson  <rth@redhat.com>
+
+        PR c/18282
+       * c-decl.c (finish_enum): Retain precision acquired from an attribute.
+
 2004-12-23  Alexandre Oliva  <aoliva@redhat.com>
 
        PR target/16819
index 3bb5a10e89b3bf2605a897ba195c5320138e907a..1481fcf89cf22e1919bd6f8c15dad4ff3db7376a 100644 (file)
@@ -5284,9 +5284,19 @@ finish_enum (tree enumtype, tree values, tree attributes)
 
   TYPE_MIN_VALUE (enumtype) = minnode;
   TYPE_MAX_VALUE (enumtype) = maxnode;
-  TYPE_PRECISION (enumtype) = precision;
   TREE_UNSIGNED (enumtype) = unsign;
   TYPE_SIZE (enumtype) = 0;
+
+  /* If the precision of the type was specific with an attribute and it
+     was too small, give an error.  Otherwise, use it.  */
+  if (TYPE_PRECISION (enumtype))
+    {
+      if (precision > TYPE_PRECISION (enumtype))
+       error ("specified mode too small for enumeral values");
+    }
+  else
+    TYPE_PRECISION (enumtype) = precision;
+
   layout_type (enumtype);
 
   if (values != error_mark_node)