ubsan: xstormy16: left shift of negative value
authorAlan Modra <amodra@gmail.com>
Sun, 15 Dec 2019 23:30:07 +0000 (10:00 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 16 Dec 2019 07:05:13 +0000 (17:35 +1030)
cpu/
* xstormy16.cpu (f-rel12a): Avoid signed overflow.
opcodes/
* xstormy16-ibld.c: Regenerate.

cpu/ChangeLog
cpu/xstormy16.cpu
opcodes/ChangeLog
opcodes/xstormy16-ibld.c

index c5a44ab45f0f63b579d9aecbc24203c50d4eb046..688c5960a33f05aa67ea83f43a9f004b072a3e1f 100644 (file)
@@ -1,3 +1,7 @@
+2019-12-16  Alan Modra  <amodra@gmail.com>
+
+       * xstormy16.cpu (f-rel12a): Avoid signed overflow.
+
 2019-12-11  Alan Modra  <amodra@gmail.com>
 
        * epiphany.cpu (f-sdisp11): Don't sign extend with shifts.
index ae7e042c92b04249bf14104ed088d6ba5c0f0c8f..aa5a464fa61cd3a14f19165ebd2e439531c456f1 100644 (file)
   (length 11)
   (mode INT)
   (encode (value pc) (sra SI (sub SI value (add SI pc 2)) 1))
-  (decode (value pc) (add SI (sll value 1) (add SI pc 2)))
+  (decode (value pc) (add SI (mul value 2) (add SI pc 2)))
 )
 (dnop rel12a "12 bit relative address" () h-uint f-rel12a)
 
index ce56ec023129cf3ba594d3b532283b79328edd16..1e13b1f7346d29b2f7e2f265584598b36c2b6dd6 100644 (file)
@@ -1,3 +1,7 @@
+2019-12-16  Alan Modra  <amodra@gmail.com>
+
+       * xstormy16-ibld.c: Regenerate.
+
 2019-12-16  Alan Modra  <amodra@gmail.com>
 
        * score-dis.c (print_insn_score16): Move rpush/rpop imm field
index babdd46def9ef5b15f2d37a6855f30e77ec0d07b..69da98678494f45a09f34d1eb769c77cc6df76a5 100644 (file)
@@ -800,7 +800,7 @@ xstormy16_cgen_extract_operand (CGEN_CPU_DESC cd,
       {
         long value;
         length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 4, 11, 32, total_length, pc, & value);
-        value = ((((value) << (1))) + (((pc) + (2))));
+        value = ((((value) * (2))) + (((pc) + (2))));
         fields->f_rel12a = value;
       }
       break;
This page took 0.027029 seconds and 4 git commands to generate.