c-decl.c (grokdeclarator): Use INTEGRAL_TYPE_P.

* 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
This commit is contained in:
Kaveh R. Ghazi 2001-06-12 12:15:46 +00:00 committed by Kaveh Ghazi
parent 0ea834c115
commit 2c1a24210c
5 changed files with 31 additions and 4 deletions

View 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

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

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

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

View File

@ -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;
}