This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA] Support true 'long double' size.
- From: Pierre Muller <muller at ics dot u-strasbg dot fr>
- To: Andrew Cagney <ac131313 at redhat dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Tue, 11 Mar 2003 13:16:43 +0100
- Subject: [RFA] Support true 'long double' size.
- References: <5.0.2.1.2.20030217174903.02c193e8@ics.u-strasbg.fr>
At 20:51 18/02/2003, Andrew Cagney wrote:
>>Index: doublest.c
>>===================================================================
>>RCS file: /cvs/src/src/gdb/doublest.c,v
>>retrieving revision 1.11
>>diff -u -p -r1.11 doublest.c
>>--- doublest.c 4 Dec 2002 05:40:40 -0000 1.11
>>+++ doublest.c 17 Feb 2003 16:07:19 -0000
>>@@ -633,6 +633,8 @@ floatformat_from_length (int len)
>> return TARGET_DOUBLE_FORMAT;
>> else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT)
>> return TARGET_LONG_DOUBLE_FORMAT;
>>+ else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT_ALTERNATE)
>>+ return TARGET_LONG_DOUBLE_FORMAT;
>>
>> return NULL;
>> }
>
>Would simply adding:
>
>else if (TARGET_LONG_DOUBLE_FORMAT != NULL
> && len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_FORMAT->totalsize)
> ..
>
>to the end of that if() chain work? (and the other alternatives as well of course).
Yes this works and has the same functionality
for the i386 specific problem.
>Otherwize, yes, I can't see any other way of handling this problem :-(
The old patch might still be usefull for other processors,
but I am not sure about that.
So here is a new simplified patch proposal:
ChangeLog entry:
2003-03-11 Pierre Muller <muller at ics dot u-strasbg dot fr>
* doublest.c (floatformat_from_length): Accept also
the real size of 'long double' type.
Index: doublest.c
===================================================================
RCS file: /cvs/src/src/gdb/doublest.c,v
retrieving revision 1.12
diff -p -u -r1.12 doublest.c
--- doublest.c 27 Feb 2003 18:08:25 -0000 1.12
+++ doublest.c 11 Mar 2003 12:17:52 -0000
@@ -633,6 +633,14 @@ floatformat_from_length (int len)
return TARGET_DOUBLE_FORMAT;
else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT)
return TARGET_LONG_DOUBLE_FORMAT;
+ /* On i386 the 'long double' type takes 96 bits,
+ while the real number of used bits is only 80,
+ both in processor and in memory.
+ The code below accepts the real bit size. */
+ else if ((TARGET_LONG_DOUBLE_FORMAT)
+ && (len * TARGET_CHAR_BIT ==
+ TARGET_LONG_DOUBLE_FORMAT->totalsize))
+ return TARGET_LONG_DOUBLE_FORMAT;
return NULL;
}
Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller at ics dot u-strasbg dot fr
Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99