+2001-02-12 Jakub Jelinek <jakub@redhat.com>
+
+ * c-common.c (constant_fits_type_p): New function.
+ (convert_and_check): Use it.
+
2001-02-11 Mark Mitchell <mark@codesourcery.com>
* Makefile.in (GXX_ABI_FLAG): Don't define.
int, int, int));
static void init_attributes PARAMS ((void));
static int default_valid_lang_attribute PARAMS ((tree, tree, tree, tree));
+static int constant_fits_type_p PARAMS ((tree, tree));
/* Keep a stack of if statements. We record the number of compound
statements seen up to the if keyword, as well as the line number
}
}
+/* Nonzero if constant C has a value that is permissible
+ for type TYPE (an INTEGER_TYPE). */
+
+static int
+constant_fits_type_p (c, type)
+ tree c, type;
+{
+ if (TREE_CODE (c) == INTEGER_CST)
+ return int_fits_type_p (c, type);
+
+ c = convert (type, c);
+ return !TREE_OVERFLOW (c);
+}
+
/* Convert EXPR to TYPE, warning about conversion problems with constants.
Invoke this function on every expression that is converted implicitly,
i.e. because of language rules and not because of an explicit cast. */
don't warn unless pedantic. */
if ((pedantic
|| TREE_UNSIGNED (type)
- || ! int_fits_type_p (expr, unsigned_type (type)))
+ || ! constant_fits_type_p (expr, unsigned_type (type)))
&& skip_evaluation == 0)
warning ("overflow in implicit constant conversion");
}
+2001-02-12 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.c-torture/compile/20010209-1.c: New test.
+
2001-02-11 Jeffrey Oldham <oldham@codesourcery.com>
* g++.old-deja/g++.other/crash26.C: XFAIL if parser produces