diff options
author | Jeff Law <law@redhat.com> | 2015-09-29 10:25:21 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2015-09-29 10:25:21 -0600 |
commit | 3ea7f8e52498b9db9a16fe61ea4c37619acb088b (patch) | |
tree | 62228c6518a05a0eaa8e3cfad34c29528a591265 | |
parent | 6d601106549923b90769b0bbf6bad9052a9667ac (diff) | |
download | gcc-3ea7f8e52498b9db9a16fe61ea4c37619acb088b.zip gcc-3ea7f8e52498b9db9a16fe61ea4c37619acb088b.tar.gz gcc-3ea7f8e52498b9db9a16fe61ea4c37619acb088b.tar.bz2 |
[PATCH] Fix undefined behaviour in msp430 port
* config/msp430/msp430.c (msp430_legitimate_constant): Fix undefined
left shift behaviour.
* config/msp430/constraints.md ('L' constraint): Similarly.
('Ys' constraint): Similarly.
From-SVN: r228251
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/msp430/constraints.md | 4 | ||||
-rw-r--r-- | gcc/config/msp430/msp430.c | 2 |
3 files changed, 10 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03f566c..1b9985a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-09-29 Jeff Law <law@redhat.com> + + * config/msp430/msp430.c (msp430_legitimate_constant): Fix undefined + left shift behaviour. + * config/msp430/constraints.md ('L' constraint): Similarly. + ('Ys' constraint): Similarly. + 2015-09-29 Richard Biener <rguenther@suse.de> PR tree-optimization/67170 diff --git a/gcc/config/msp430/constraints.md b/gcc/config/msp430/constraints.md index 30f944c..dfda152 100644 --- a/gcc/config/msp430/constraints.md +++ b/gcc/config/msp430/constraints.md @@ -32,7 +32,7 @@ (define_constraint "L" "Integer constant -1^20..1^19." (and (match_code "const_int") - (match_test "IN_RANGE (ival, -1 << 20, 1 << 19)"))) + (match_test "IN_RANGE (ival, HOST_WIDE_INT_M1U << 20, 1 << 19)"))) (define_constraint "M" "Integer constant 1-4." @@ -77,7 +77,7 @@ (and (match_code "plus" "0") (and (match_code "reg" "00") (match_test ("CONST_INT_P (XEXP (XEXP (op, 0), 1))")) - (match_test ("IN_RANGE (INTVAL (XEXP (XEXP (op, 0), 1)), -1 << 15, (1 << 15)-1)")))) + (match_test ("IN_RANGE (INTVAL (XEXP (XEXP (op, 0), 1)), HOST_WIDE_INT_M1U << 15, (1 << 15)-1)")))) (match_code "reg" "0") ))) diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index d2308cb..ba8d862 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -998,7 +998,7 @@ msp430_legitimate_constant (machine_mode mode, rtx x) /* GCC does not know the width of the PSImode, so make sure that it does not try to use a constant value that is out of range. */ - || (INTVAL (x) < (1 << 20) && INTVAL (x) >= (-1 << 20)); + || (INTVAL (x) < (1 << 20) && INTVAL (x) >= (HOST_WIDE_INT)(HOST_WIDE_INT_M1U << 20)); } |