This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] NDS32/opcodes: Fix out-of-range integer constant
- From: Kuan-Lin Chen <kuanlinchentw at gmail dot com>
- To: "binutils at sourceware dot org Development" <binutils at sourceware dot org>, "Maciej W. Rozycki" <macro at codesourcery dot com>
- Cc: Wei-cheng Wang <cole945 at gmail dot com>
- Date: Mon, 6 Jan 2014 10:51:08 +0800
- Subject: Re: [PATCH] NDS32/opcodes: Fix out-of-range integer constant
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 1 dot 10 dot 1401032322370 dot 19368 at tp dot orcam dot me dot uk> <CAPmZyH4Q3skyDeTjdwfbRT7YWn-Ai3xBbg1Gz8V86Me964H5FA at mail dot gmail dot com>
Hi, Maciej
Thanks for your patch.
I removed the initialization and applied the patch as follows:
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 8a9d7e6..fbb86a3 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
+2014-01-03 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * nds32-asm.c (parse_operand): Fix out-of-range integer constant.
+
2013-12-17 Kuan-Lin Chen <kuanlinchentw@gmail.com>
* nds32-dis.c (sr_map): Add system register table for disassembling.
diff --git a/opcodes/nds32-asm.c b/opcodes/nds32-asm.c
index d7681bf..62512dd 100644
--- a/opcodes/nds32-asm.c
+++ b/opcodes/nds32-asm.c
@@ -1370,7 +1370,7 @@ parse_operand (nds32_asm_desc_t *pdesc,
nds32_asm_insn_t *pinsn,
hashval_t hash;
const field_t *fld = &LEX_GET_FIELD (syn);
keyword_t *k;
- int64_t value = 0x100000000; /* Big enough to overflow. */
+ int64_t value;
int r;
uint64_t modifier = 0;
2014/1/4 Wei-cheng Wang <cole945@gmail.com>:
> Hi Maciej,
>
> Thanks for reviewing nds32 port :)
>
> According to the table of c99 6.4.4.1 Integer constants,
> the type of 0x100000000 is already long long int,
> so it shouldn't matter whether LL is suffixed.
>
> And the value was used for check whether we successfully `parse' the operand,
> but now we check the return value of `parse', so the initial value is
> useless now.
> We should simply remove it.
>
> Wei-cheng
>
>
> On Sat, Jan 4, 2014 at 7:40 AM, Maciej W. Rozycki
> <macro@codesourcery.com> wrote:
>> Hi,
>>
>> This corrects the type of an out-of-range integer constant, removing a
>> build error (GCC 4.3.2):
>>
>> .../opcodes/nds32-asm.c: In function 'parse_operand':
>> .../opcodes/nds32-asm.c:1373: error: integer constant is too large for 'long' type
>>
>> OK to apply?
>>
>> 2014-01-03 Maciej W. Rozycki <macro@codesourcery.com>
>>
>> opcodes/
>> * nds32-asm.c (parse_operand): Fix out-of-range integer constant.
>>
>> Maciej
>>
>> binutils-opc-nds32-const.diff
>> Index: gdb-fsf-trunk-quilt/opcodes/nds32-asm.c
>> ===================================================================
>> --- gdb-fsf-trunk-quilt.orig/opcodes/nds32-asm.c 2014-01-03 21:14:24.000000000 +0000
>> +++ gdb-fsf-trunk-quilt/opcodes/nds32-asm.c 2014-01-03 23:22:48.897953981 +0000
>> @@ -1370,7 +1370,7 @@ parse_operand (nds32_asm_desc_t *pdesc,
>> hashval_t hash;
>> const field_t *fld = &LEX_GET_FIELD (syn);
>> keyword_t *k;
>> - int64_t value = 0x100000000; /* Big enough to overflow. */
>> + int64_t value = 0x100000000LL; /* Big enough to overflow. */
>> int r;
>> uint64_t modifier = 0;
>>
--
Best regards,
Kuan-Lin Chen.
kuanlinchentw@gmail.com