summaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 103b50db0fc..42f6561e498 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3642,7 +3642,8 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
/* Detect and ignore out of range field width and process valid
field widths. */
- if (TREE_CODE (*width) != INTEGER_CST)
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (*width))
+ || TREE_CODE (*width) != INTEGER_CST)
{
error ("bit-field %qs width not an integer constant", name);
*width = integer_one_node;
@@ -5633,7 +5634,8 @@ build_enumerator (tree name, tree value)
undeclared identifier) - just ignore the value expression. */
if (value == error_mark_node)
value = 0;
- else if (TREE_CODE (value) != INTEGER_CST)
+ else if (!INTEGRAL_TYPE_P (TREE_TYPE (value))
+ || TREE_CODE (value) != INTEGER_CST)
{
error ("enumerator value for %qE is not an integer constant", name);
value = 0;