* [RFA] testsuite/gdb.base/pointers.[c,exp]: don't assume >= 8 byte doubles
@ 2001-02-26 9:51 Orjan Friberg
2001-03-06 9:03 ` Fernando Nasser
0 siblings, 1 reply; 4+ messages in thread
From: Orjan Friberg @ 2001-02-26 9:51 UTC (permalink / raw)
To: gdb-patches
(This is a resubmission.) In pointers.c, a double D is assigned
-1.375E-123. This only fits if a double is (at least) 8 bytes. For a
4-byte double you get an underflow. The pattern matching of the
decimals when printing the value of D also assumes it's >= 8 bytes. K&R
says an acceptable minimum for FLT_MIN is 1E-37, so I decided to go with
that and relaxed the decimal pattern matching to the same level as for
floats.
Ok to commit?
Orjan
2001-02-26 Orjan Friberg <orjanf@axis.com>
* gdb.base/pointers.c: Don't assume doubles are >= 8 bytes.
* gdb.base/pointers.exp: Relax pattern match of decimals.
*** /home/orjanf/gdb-HEAD/src/gdb/testsuite/gdb.base/pointers.c Wed Mar
22 00:01
:49 2000
--- pointers.c Wed Nov 1 14:28:52 2000
*************** int more_code()
*** 194,200 ****
L = -234;
UL = 234;
F = 1.25E10;
! D = -1.375E-123;
pC = &C;
ppC = &pC;
pppC = &ppC;
--- 194,200 ----
L = -234;
UL = 234;
F = 1.25E10;
! D = -1.25E-37;
pC = &C;
ppC = &pC;
pppC = &ppC;
*** /home/orjanf/gdb-HEAD/src/gdb/testsuite/gdb.base/pointers.exp
Mon Feb
26 18:34:53 2001
--- pointers.exp Mon Feb 26 18:34:36 2001
*************** gdb_expect {
*** 527,533 ****
send_gdb "print *pD\n"
gdb_expect {
! -re ".\[0-9\]* = -1.375e-123.*$gdb_prompt $" {
pass "print value of *pD"
}
-re ".*$gdb_prompt $" { fail "print value of *pD" }
--- 527,533 ----
send_gdb "print *pD\n"
gdb_expect {
! -re ".\[0-9\]* = -1.2\[0-9\]*e\\-37.*$gdb_prompt $" {
pass "print value of *pD"
}
-re ".*$gdb_prompt $" { fail "print value of *pD" }
--
Orjan Friberg E-mail: orjan.friberg@axis.com
Axis Communications AB Phone: +46 46 272 17 68
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] testsuite/gdb.base/pointers.[c,exp]: don't assume >= 8 byte doubles
2001-02-26 9:51 [RFA] testsuite/gdb.base/pointers.[c,exp]: don't assume >= 8 byte doubles Orjan Friberg
@ 2001-03-06 9:03 ` Fernando Nasser
2001-03-07 9:39 ` Orjan Friberg
0 siblings, 1 reply; 4+ messages in thread
From: Fernando Nasser @ 2001-03-06 9:03 UTC (permalink / raw)
To: Orjan Friberg; +Cc: gdb-patches
Orjan Friberg wrote:
>
> (This is a resubmission.) In pointers.c, a double D is assigned
> -1.375E-123. This only fits if a double is (at least) 8 bytes. For a
> 4-byte double you get an underflow. The pattern matching of the
> decimals when printing the value of D also assumes it's >= 8 bytes. K&R
> says an acceptable minimum for FLT_MIN is 1E-37, so I decided to go with
> that and relaxed the decimal pattern matching to the same level as for
> floats.
>
> Ok to commit?
>
Yes, I believe we discussed this long ago and all agreed that it was a sensible change.
Thanks.
Fernando
> Orjan
>
> 2001-02-26 Orjan Friberg <orjanf@axis.com>
>
> * gdb.base/pointers.c: Don't assume doubles are >= 8 bytes.
> * gdb.base/pointers.exp: Relax pattern match of decimals.
>
> *** /home/orjanf/gdb-HEAD/src/gdb/testsuite/gdb.base/pointers.c Wed Mar
> 22 00:01
> :49 2000
> --- pointers.c Wed Nov 1 14:28:52 2000
> *************** int more_code()
> *** 194,200 ****
> L = -234;
> UL = 234;
> F = 1.25E10;
> ! D = -1.375E-123;
> pC = &C;
> ppC = &pC;
> pppC = &ppC;
> --- 194,200 ----
> L = -234;
> UL = 234;
> F = 1.25E10;
> ! D = -1.25E-37;
> pC = &C;
> ppC = &pC;
> pppC = &ppC;
>
> *** /home/orjanf/gdb-HEAD/src/gdb/testsuite/gdb.base/pointers.exp
> Mon Feb
> 26 18:34:53 2001
> --- pointers.exp Mon Feb 26 18:34:36 2001
> *************** gdb_expect {
> *** 527,533 ****
>
> send_gdb "print *pD\n"
> gdb_expect {
> ! -re ".\[0-9\]* = -1.375e-123.*$gdb_prompt $" {
> pass "print value of *pD"
> }
> -re ".*$gdb_prompt $" { fail "print value of *pD" }
> --- 527,533 ----
>
> send_gdb "print *pD\n"
> gdb_expect {
> ! -re ".\[0-9\]* = -1.2\[0-9\]*e\\-37.*$gdb_prompt $" {
> pass "print value of *pD"
> }
> -re ".*$gdb_prompt $" { fail "print value of *pD" }
>
> --
> Orjan Friberg E-mail: orjan.friberg@axis.com
> Axis Communications AB Phone: +46 46 272 17 68
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] testsuite/gdb.base/pointers.[c,exp]: don't assume >= 8 byte doubles
2001-03-06 9:03 ` Fernando Nasser
@ 2001-03-07 9:39 ` Orjan Friberg
0 siblings, 0 replies; 4+ messages in thread
From: Orjan Friberg @ 2001-03-07 9:39 UTC (permalink / raw)
To: gdb-patches
Fernando Nasser wrote:
>
> Orjan Friberg wrote:
> >
> > (This is a resubmission.) In pointers.c, a double D is assigned
> > -1.375E-123. This only fits if a double is (at least) 8 bytes. For a
> > 4-byte double you get an underflow. The pattern matching of the
> > decimals when printing the value of D also assumes it's >= 8 bytes. K&R
> > says an acceptable minimum for FLT_MIN is 1E-37, so I decided to go with
> > that and relaxed the decimal pattern matching to the same level as for
> > floats.
> >
> > Ok to commit?
> >
>
> Yes, I believe we discussed this long ago and all agreed that it was a sensible change.
>
> Thanks.
> Fernando
>
Committed. Thanks to Michael for reviewing and testing the patch.
BTW, the cvs commit messages for pointers.c and pointers.exp
accidentally got the 2001-02-26 date (which was when I submitted the
patch). I updated the date in the ChangeLog entry (and ChangeLog's cvs
commit message) though. Sorry about that.
--
Orjan Friberg E-mail: orjan.friberg@axis.com
Axis Communications AB Phone: +46 46 272 17 68
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] testsuite/gdb.base/pointers.[c,exp]: don't assume >= 8 byte doubles
@ 2001-02-26 11:14 Michael Elizabeth Chastain
0 siblings, 0 replies; 4+ messages in thread
From: Michael Elizabeth Chastain @ 2001-02-26 11:14 UTC (permalink / raw)
To: gdb-patches, orjan.friberg
Hi Orjan,
I proofread this and tested it on a Red Hat 7 Linux native system.
It works for me.
> K&R says an acceptable minimum for FLT_MIN is 1E-37, so I decided to go
> with that and relaxed the decimal pattern matching to the same level as
> for floats.
ISO C standard section 5.2.4.2, "numerical limits", addresses this.
It says: "minimum normalized positive floating-point number:"
FLT_MIN 1e-37
DBL_MIN 1e-37
LDBL_MIN 1e-37
So I agree; it is legal for an implementation to implement
doubles as 32-bit IEEE 754 numbers.
> Ok to commit?
I recommend this patch for approval but I do not have approval power.
Fernando? Stan?
Michael
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-03-07 9:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-26 9:51 [RFA] testsuite/gdb.base/pointers.[c,exp]: don't assume >= 8 byte doubles Orjan Friberg
2001-03-06 9:03 ` Fernando Nasser
2001-03-07 9:39 ` Orjan Friberg
2001-02-26 11:14 Michael Elizabeth Chastain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox