fold-const.c (force_fit_type): Unsigned values can overflow if they are sizetype.
* fold-const.c (force_fit_type): Unsigned values can overflow if they are sizetype. (int_const_binop): Don't use cache if overflows. * cp/typeck.c (dubious_conversion_warning): Suppress if TYPE_IS_SIZETYPE. From-SVN: r36970
This commit is contained in:
parent
23ccfa6dbb
commit
4447513857
@ -1,3 +1,8 @@
|
||||
Fri Oct 20 13:33:16 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
||||
|
||||
* fold-const.c (force_fit_type): Unsigned values can overflow
|
||||
if they are sizetype.
|
||||
(int_const_binop): Don't use cache if overflows.
|
||||
2000-10-20 Richard Henderson <rth@cygnus.com>
|
||||
|
||||
* function.c (locate_and_pad_parm): Zero alignment_pad.
|
||||
|
@ -1,3 +1,7 @@
|
||||
Fri Oct 20 13:54:59 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
||||
|
||||
* typeck.c (dubious_conversion_warning): Suppress if TYPE_IS_SIZETYPE.
|
||||
|
||||
2000-10-20 Jeffrey Oldham <oldham@codesourcery.com>
|
||||
|
||||
* decl.c (revert_static_member_fn): Fixed typo.
|
||||
|
@ -6353,7 +6353,16 @@ dubious_conversion_warnings (type, expr, errtype, fndecl, parmnum)
|
||||
cp_warning ("%s of negative value `%E' to `%T'",
|
||||
errtype, expr, type);
|
||||
}
|
||||
overflow_warning (expr);
|
||||
|
||||
/* Suppress warning for a sizetype since we never used to issue it.
|
||||
??? This needs to be looked at more carefully someday. */
|
||||
if (TREE_CODE (expr) == INTEGER_CST
|
||||
&& TREE_CODE (TREE_TYPE (expr)) == INTEGER_TYPE
|
||||
&& TYPE_IS_SIZETYPE (TREE_TYPE (expr)))
|
||||
TREE_OVERFLOW (expr) = TREE_CONSTANT_OVERFLOW (expr) = 0;
|
||||
else
|
||||
overflow_warning (expr);
|
||||
|
||||
if (TREE_CONSTANT (expr))
|
||||
expr = fold (expr);
|
||||
}
|
||||
|
@ -216,8 +216,11 @@ force_fit_type (t, overflow)
|
||||
TREE_INT_CST_LOW (t) &= ~((unsigned HOST_WIDE_INT) (-1) << prec);
|
||||
}
|
||||
|
||||
/* Unsigned types do not suffer sign extension or overflow. */
|
||||
if (TREE_UNSIGNED (TREE_TYPE (t)))
|
||||
/* Unsigned types do not suffer sign extension or overflow unless they
|
||||
are a sizetype. */
|
||||
if (TREE_UNSIGNED (TREE_TYPE (t))
|
||||
&& ! (TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE
|
||||
&& TYPE_IS_SIZETYPE (TREE_TYPE (t))))
|
||||
return overflow;
|
||||
|
||||
/* If the value's sign bit is set, extend the sign. */
|
||||
@ -1604,7 +1607,8 @@ int_const_binop (code, arg1, arg2, notrunc, forsize)
|
||||
abort ();
|
||||
}
|
||||
|
||||
if (forsize && hi == 0 && low < 10000)
|
||||
if (forsize && hi == 0 && low < 10000
|
||||
&& overflow == 0 && ! TREE_OVERFLOW (arg1) && ! TREE_OVERFLOW (arg2))
|
||||
return size_int_type_wide (low, TREE_TYPE (arg1));
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user