This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Fixed-point] Bug in interpret_fixed ?
- From: "Chao-ying Fu" <fu at mips dot com>
- To: "Mohamed Shafi" <shafitvm at gmail dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 31 Jan 2007 11:27:40 -0800
- Subject: Re: [Fixed-point] Bug in interpret_fixed ?
- References: <ba0bd44d0701310548q76386403i9fbfe3b6e2e9bb95@mail.gmail.com>
- Reply-to: "Chao-ying Fu" <fu at mips dot com>
Hi sir,
Thanks a lot!
2007-01-31 Chao-ying Fu <fu@mips.com>
* c-lex.c (interpret_fixed): Fix a bug of copylen for unsigned accum
types.
Regards,
Chao-ying
Index: c-lex.c
===================================================================
--- c-lex.c (revision 121327)
+++ c-lex.c (working copy)
@@ -769,22 +769,22 @@
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
{
type = unsigned_long_long_accum_type_node;
- copylen -= 3;
+ copylen -= 4;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
{
type = unsigned_long_accum_type_node;
- copylen -= 2;
+ copylen -= 3;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
{
type = unsigned_short_accum_type_node;
- copylen -= 2;
+ copylen -= 3;
}
else
{
type = unsigned_accum_type_node;
- copylen --;
+ copylen -= 2;
}
}
else /* Signed _Accum. */
----- Original Message -----
From: "Mohamed Shafi" <shafitvm@gmail.com>
To: <gcc-patches@gcc.gnu.org>
Cc: "Chao-ying Fu" <fu@mips.com>
Sent: Wednesday, January 31, 2007 5:48 AM
Subject: [Fixed-point] Bug in interpret_fixed ?
> Hello,
>
> Is the variable "copylen", in the function interpret_fixed in c-lex.c,
> updated properly for accum data types?
>
> Here is the relevant portion.of the file(for unsigned accum)
>
http://gcc.gnu.org/viewcvs/branches/fixed-point/gcc/c-lex.c?revision=118838&view=markup
>
>
> if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
> {
> type = unsigned_long_long_accum_type_node;
> copylen -= 3;
> }
> else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
> {
> type = unsigned_long_accum_type_node;
> copylen -= 2;
> }
> else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
> {
> type = unsigned_short_accum_type_node;
> copylen -= 2;
> }
> else
> {
> type = unsigned_accum_type_node;
> copylen --;
> }
>
>
> Regards,
> Shafi
>