c-decl.c (grokdeclarator): Use INTEGRAL_TYPE_P.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Tue, 12 Jun 2001 12:15:46 +0000 (12:15 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Tue, 12 Jun 2001 12:15:46 +0000 (12:15 +0000)
* c-decl.c (grokdeclarator): Use INTEGRAL_TYPE_P.

* c-typeck.c (c_start_case): Likewise.

testsuite:
* gcc.c-torture/compile/20010610-1.c: New test.

From-SVN: r43257

gcc/ChangeLog
gcc/c-decl.c
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20010610-1.c [new file with mode: 0644]

index f3fff9f4ba0d5bac2f8098ee86728cb61b2187b0..9868b84b77ffeb253e6ccfb030c47e4a095073f4 100644 (file)
@@ -1,3 +1,9 @@
+2001-06-12  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * c-decl.c (grokdeclarator): Use INTEGRAL_TYPE_P.
+
+       * c-typeck.c (c_start_case): Likewise.
+
 2001-06-12  Mark Mitchell  <mark@codesourcery.com>
 
        * expr.c (store_field): Don't set MEM_ALIAS_SET for a field
index 5d50394d551e0202554c9616fb72b4a0ebf22cb6..2c16afb97a3a446408b082174840504ad6db7fda 100644 (file)
@@ -4357,8 +4357,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
              /* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue.  */
              STRIP_TYPE_NOPS (size);
 
-             if (TREE_CODE (TREE_TYPE (size)) != INTEGER_TYPE
-                 && TREE_CODE (TREE_TYPE (size)) != ENUMERAL_TYPE)
+             if (! INTEGRAL_TYPE_P (TREE_TYPE (size)))
                {
                  error ("size of array `%s' has non-integer type", name);
                  size = integer_one_node;
index 5653ae59b68319a81ddc1479d6a185fa053c5b06..cf995334b9af80c407cd75bae96893a4a8b8613f 100644 (file)
@@ -7077,8 +7077,7 @@ c_start_case (exp)
       code = TREE_CODE (TREE_TYPE (exp));
       type = TREE_TYPE (exp);
 
-      if (code != INTEGER_TYPE 
-         && code != ENUMERAL_TYPE 
+      if (! INTEGRAL_TYPE_P (type)
          && code != ERROR_MARK)
        {
          error ("switch quantity not an integer");
index a4dfba0301cf24000436cd6be59d5d4a5f17e985..dfc4b53d9d65acd90168d89cc4f1b7cb34d5c50e 100644 (file)
@@ -1,3 +1,7 @@
+2001-06-12  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * gcc.c-torture/compile/20010610-1.c: New test.
+
 2001-06-12  Nathan Sidwell  <nathan@codesourcery.com>
 
        * g++.old-deja/g++.abi/vbase4.C: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20010610-1.c b/gcc/testsuite/gcc.c-torture/compile/20010610-1.c
new file mode 100644 (file)
index 0000000..ee8e243
--- /dev/null
@@ -0,0 +1,19 @@
+/* Origin: Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+   Boolean types were not accepted as array sizes nor as switch
+   quantities.  */
+
+#include <stdbool.h>
+
+int
+main(void)
+{
+  bool arr[(bool)1];
+  
+  switch (arr[0])
+    {
+    default:;
+    }
+
+  return 0;
+}