aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/h8300
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2015-09-21 11:09:53 -0600
committerJeff Law <law@gcc.gnu.org>2015-09-21 11:09:53 -0600
commitd7b00a16de70d84dce94a1f760265497f3408a7b (patch)
treec5918fcbec8344440b4eb7beeb5d489477c19b60 /gcc/config/h8300
parentbdaaa8b70f8e76b2743ee7bafc438e499411753f (diff)
downloadgcc-d7b00a16de70d84dce94a1f760265497f3408a7b.zip
gcc-d7b00a16de70d84dce94a1f760265497f3408a7b.tar.gz
gcc-d7b00a16de70d84dce94a1f760265497f3408a7b.tar.bz2
[PATCH] Fix undefined behavior in h8300 backend
* config/h8300/h8300.md (andsi3_ashift_n_lower): Avoid undefined behavior. * gcc.target/h8300/andsi3_ashift_n_lower.c: New test. From-SVN: r227978
Diffstat (limited to 'gcc/config/h8300')
-rw-r--r--gcc/config/h8300/h8300.md3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
index 4079b30..52213ac 100644
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -3914,7 +3914,8 @@
(clobber (match_scratch:QI 4 "=X,&r"))]
"(TARGET_H8300H || TARGET_H8300S)
&& INTVAL (operands[2]) <= 15
- && INTVAL (operands[3]) == ((-1 << INTVAL (operands[2])) & 0xffff)"
+ && UINTVAL (operands[3]) == ((HOST_WIDE_INT_M1U << INTVAL (operands[2]))
+ & 0xffff)"
"#"
"&& reload_completed"
[(parallel [(set (match_dup 5)