#include "tree.h"
#include "flags.h"
#include "convert.h"
-#include "toplev.h"
+#include "diagnostic-core.h"
#include "langhooks.h"
/* Convert EXPR to some pointer or reference type TYPE.
|| ex_form == LSHIFT_EXPR
/* If we have !flag_wrapv, and either ARG0 or
ARG1 is of a signed type, we have to do
- PLUS_EXPR or MINUS_EXPR in an unsigned
- type. Otherwise, we would introduce
+ PLUS_EXPR, MINUS_EXPR or MULT_EXPR in an unsigned
+ type in case the operation in outprec precision
+ could overflow. Otherwise, we would introduce
signed-overflow undefinedness. */
|| ((!TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg0))
|| !TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg1)))
+ && ((TYPE_PRECISION (TREE_TYPE (arg0)) * 2u
+ > outprec)
+ || (TYPE_PRECISION (TREE_TYPE (arg1)) * 2u
+ > outprec))
&& (ex_form == PLUS_EXPR
- || ex_form == MINUS_EXPR)))
+ || ex_form == MINUS_EXPR
+ || ex_form == MULT_EXPR)))
typex = unsigned_type_for (typex);
else
typex = signed_type_for (typex);
/* This is not correct for ABS_EXPR,
since we must test the sign before truncation. */
{
- tree typex;
-
- /* Don't do unsigned arithmetic where signed was wanted,
- or vice versa. */
- if (TYPE_UNSIGNED (TREE_TYPE (expr)))
- typex = unsigned_type_for (type);
- else
- typex = signed_type_for (type);
+ tree typex = unsigned_type_for (type);
return convert (type,
fold_build1 (ex_form, typex,
convert (typex,
case VECTOR_TYPE:
if (!tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (TREE_TYPE (expr))))
{
- error ("can't convert between vector values of different size");
+ error ("can%'t convert between vector values of different size");
return error_mark_node;
}
return build1 (VIEW_CONVERT_EXPR, type, expr);
case VECTOR_TYPE:
if (!tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (TREE_TYPE (expr))))
{
- error ("can't convert between vector values of different size");
+ error ("can%'t convert between vector values of different size");
return error_mark_node;
}
return build1 (VIEW_CONVERT_EXPR, type, expr);
default:
- error ("can't convert value to a vector");
+ error ("can%'t convert value to a vector");
return error_mark_node;
}
}