* c-common.c (shorten_compare): Don't -Wtype-limits if the
non-constant operand comes from a macro.
From-SVN: r230589
+2015-11-18 Jason Merrill <jason@redhat.com>
+
+ * c-common.c (shorten_compare): Don't -Wtype-limits if the
+ non-constant operand comes from a macro.
+
2015-11-17 Jason Merrill <jason@redhat.com>
PR bootstrap/68346
type = c_common_unsigned_type (type);
}
- if (TREE_CODE (primop0) != INTEGER_CST)
+ if (TREE_CODE (primop0) != INTEGER_CST
+ /* Don't warn if it's from a macro. */
+ && !from_macro_expansion_at (EXPR_LOCATION (primop0)))
{
if (val == truthvalue_false_node)
warning_at (loc, OPT_Wtype_limits,
--- /dev/null
+// { dg-options -Wtype-limits }
+
+unsigned char array[4];
+bool b;
+#define VAL (b ? array[0] : (unsigned char)0)
+
+int main()
+{
+ if (VAL > 1000)
+ __builtin_abort();
+}