PR 28215: [CSKY] Don't abort while immediate overflow

Message ID 20210810065557.558-1-lifang_xia@c-sky.com
State New
Headers show
Series
  • PR 28215: [CSKY] Don't abort while immediate overflow
Related show

Commit Message

=?UTF-8?B?5aSP56uL5pa5?= Aug. 10, 2021, 6:55 a.m.
That's no necessary to abort while immediate out of range in
md_apply_fix. It will report error in the caller which is fixup_segment.

gas/
	* config/tc-csky.c (md_apply_fix): Do nothing here, just break
	from the switch-case.
---
 gas/config/tc-csky.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.17.1

Comments

H.J. Lu via Binutils Aug. 11, 2021, 12:51 p.m. | #1
Hi Lifang,

> That's no necessary to abort while immediate out of range in

> md_apply_fix. It will report error in the caller which is fixup_segment.

> 

> gas/

> 	* config/tc-csky.c (md_apply_fix): Do nothing here, just break

> 	from the switch-case.


Great minds think alike.  This problem was reported as PR 28215, and I
checked in a patch to fix it that is almost the same as yours...

Cheers
   Nick

Patch

diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c
index 35a7252786c..343c4e6cdb4 100644
--- a/gas/config/tc-csky.c
+++ b/gas/config/tc-csky.c
@@ -5476,7 +5476,9 @@  md_apply_fix (fixS   *fixP,
 	  else if (fixP->fx_size == 1 && val >= -256 && val <= 255)
 	    ;
 	  else
-	    abort ();
+	    /* Do nothing if overflow. It will report error in fixup_segment */
+	    break;
+
 	  md_number_to_chars (buf, val, fixP->fx_size);
 	  fixP->fx_done = 1;
 	}