ubsan: iq2000: left shift of negative value
authorAlan Modra <amodra@gmail.com>
Mon, 23 Dec 2019 07:34:12 +0000 (18:04 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 23 Dec 2019 07:34:12 +0000 (18:04 +1030)
cpu/
* iq2000.cpu (f-offset): Avoid left shift of negative values.
opcodes/
* iq2000-ibld.c: Regenerate.

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

index 1729efd266c1cfde651203e77e4c199eb22b6273..3e6a8d8c4d0defb368ad077f9aff8d36b7aadf7f 100644 (file)
@@ -1,3 +1,7 @@
+2019-12-23  Alan Modra  <amodra@gmail.com>
+
+       * iq2000.cpu (f-offset): Avoid left shift of negative values.
+
 2019-12-20  Alan Modra  <amodra@gmail.com>
 
        * or1korbis.cpu (f-disp26, f-disp21): Don't left shift negative values.
index e25ba69392bb998fd78394513f22c80bd761697d..cb9cfae1d43e173f8ea6401e6d96d757bc72c055 100644 (file)
 (df  f-offset "pc offset field"                (PCREL-ADDR) 15 16 INT
      ; Actually, this is relative to the address of the delay slot.
      ((value pc) (sra SI (sub SI value pc) 2))
-     ((value pc) (add SI (sll SI value 2) (add pc 4))))
+     ((value pc) (add SI (mul SI value 4) (add pc 4))))
 
 ; Instruction fields that scarcely appear in instructions.
 
index 1c5592ae26df5f583710ebe08d1d959479929f18..c3a97523bcbdf5fbe1e98225e0bcb01ac23d62ed 100644 (file)
@@ -1,3 +1,7 @@
+2019-12-23  Alan Modra  <amodra@gmail.com>
+
+       * iq2000-ibld.c: Regenerate.
+
 2019-12-23  Alan Modra  <amodra@gmail.com>
 
        * d30v-dis.c (extract_value): Make num param a uint64_t, constify
index 34482b366a65fa7b535c81d6e937c5a44d18d747..3059fe167a7675c4c729cfbeb8bb3076fdca6f6b 100644 (file)
@@ -838,7 +838,7 @@ iq2000_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, 15, 16, 32, total_length, pc, & value);
-        value = ((((value) << (2))) + (((pc) + (4))));
+        value = ((((value) * (4))) + (((pc) + (4))));
         fields->f_offset = value;
       }
       break;
This page took 0.03054 seconds and 4 git commands to generate.