diff options
author | kazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-12-26 23:00:18 +0000 |
---|---|---|
committer | kazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-12-26 23:00:18 +0000 |
commit | 5a4a8e04ada922e80a95ea56d68d9b1d84962163 (patch) | |
tree | 71fa7e22af360fe7beb5c11eb309505bf13890ab /gcc/convert.c | |
parent | 49938a1b8fb66ecb7ece9e55cd48d8dae4f93eb0 (diff) | |
download | gcc-5a4a8e04ada922e80a95ea56d68d9b1d84962163.tar.gz |
gcc/
PR tree-optimization/25125
* convert.c (convert_to_integer): Don't narrow the type of a
PLUX_EXPR or MINUS_EXPR if !flag_wrapv and the unwidened type
is signed.
gcc/testsuite/
PR tree-optimization/25125
* gcc.dg/vect/vect-7.c, gcc.dg/vect/vect-reduc-2char.c,
gcc.dg/vect/vect-reduc-2short.c: XFAIL.
* gcc.c-torture/execute/pr25125.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109065 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r-- | gcc/convert.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/convert.c b/gcc/convert.c index e8030bf9f01..805c6f5c789 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -628,7 +628,17 @@ convert_to_integer (tree type, tree expr) || ex_form == RSHIFT_EXPR || ex_form == LROTATE_EXPR || ex_form == RROTATE_EXPR)) - || ex_form == LSHIFT_EXPR) + || 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 + signed-overflow undefinedness. */ + || (!flag_wrapv + && (ex_form == PLUS_EXPR + || ex_form == MINUS_EXPR) + && (!TYPE_UNSIGNED (TREE_TYPE (arg0)) + || !TYPE_UNSIGNED (TREE_TYPE (arg1))))) typex = lang_hooks.types.unsigned_type (typex); else typex = lang_hooks.types.signed_type (typex); |