• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revision44e4546fa278122fb1ad708cf8d4835a5af0a11c (tree)
Zeit2020-02-03 14:29:08
AutorAlan Modra <amodra@gmai...>
CommiterAlan Modra

Log Message

ubsan: m32c: left shift of negative value

cpu/
* m32c.cpu (f-dsp-64-s16): Mask before shifting signed value.
opcodes/
* m32c-ibld.c: Regenerate.

Ändern Zusammenfassung

Diff

--- a/cpu/ChangeLog
+++ b/cpu/ChangeLog
@@ -1,3 +1,7 @@
1+2020-02-03 Alan Modra <amodra@gmail.com>
2+
3+ * m32c.cpu (f-dsp-64-s16): Mask before shifting signed value.
4+
15 2020-02-01 Alan Modra <amodra@gmail.com>
26
37 * frv.cpu (f-u12): Multiply rather than left shift signed values.
--- a/cpu/m32c.cpu
+++ b/cpu/m32c.cpu
@@ -781,12 +781,12 @@
781781 (df f-dsp-64-s16 " 16 bit signed" (all-isas) 64 16 INT
782782 ((value pc) (ext INT
783783 (trunc HI
784- (or (and (srl value 8) #x00ff)
785- (and (sll value 8) #xff00))))) ; insert
784+ (or (and (srl value 8) #xff)
785+ (sll (and value #xff) 8))))) ; insert
786786 ((value pc) (ext INT
787787 (trunc HI
788- (or (and (srl value 8) #x00ff)
789- (and (sll value 8) #xff00))))) ; extract
788+ (or (and (srl value 8) #xff)
789+ (sll (and value #xff) 8))))) ; extract
790790 )
791791
792792 ;-------------------------------------------------------------
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
1+2020-02-03 Alan Modra <amodra@gmail.com>
2+
3+ * m32c-ibld.c: Regenerate.
4+
15 2020-02-01 Alan Modra <amodra@gmail.com>
26
37 * frv-ibld.c: Regenerate.
--- a/opcodes/m32c-ibld.c
+++ b/opcodes/m32c-ibld.c
@@ -1401,7 +1401,7 @@ m32c_cgen_insert_operand (CGEN_CPU_DESC cd,
14011401 case M32C_OPERAND_IMM_64_HI :
14021402 {
14031403 long value = fields->f_dsp_64_s16;
1404- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
1404+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
14051405 errmsg = insert_normal (cd, value, 0|(1<<CGEN_IFLD_SIGNED), 64, 0, 16, 32, total_length, buffer);
14061406 }
14071407 break;
@@ -2561,7 +2561,7 @@ m32c_cgen_extract_operand (CGEN_CPU_DESC cd,
25612561 {
25622562 long value;
25632563 length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED), 64, 0, 16, 32, total_length, pc, & value);
2564- value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) << (8))) & (65280)))))));
2564+ value = EXTHISI (((HI) (INT) (((((((UINT) (value) >> (8))) & (255))) | (((((value) & (255))) << (8)))))));
25652565 fields->f_dsp_64_s16 = value;
25662566 }
25672567 break;