Article View: gnu.g++.lib.bug
Article #331Re: libg++-2.3 build problems under AIX-3.2
From: David Edelsohn
Date: Tue, 22 Dec 1992 22:31
Date: Tue, 22 Dec 1992 22:31
83 lines
4451 bytes
4451 bytes
[Possible gcc backend bug for RS/6000 architecture. libg++-2.3
does not pass its self-tests (make check) and calls abort because of assert
in tFile.C:t11().]
I have tracked down the bug in formatted I/O further by comparing
the steps that the Sun version takes versus the RS/6000 version. For
t11(), cout.form(...), the Sun version calls __outfloat() from
streambuf::vform() with precision=2 and fill=' ' while the RS/6000 version
uses precision=6 and fill=GARBAGE. fill is set correctly before the call
but is corrupted in the call itself (it is wrong in the called subroutine
itself so this presumably is not a gdb-4.7 bug). precision is set
differently because the Sun and RS/6000 take slightly different paths
through the code for the '.' case of the format. The Sun executes:
while (is_digit(ch)) {
n = 10 * n + to_digit(ch);
ch = *fmt++;
}
but the RS/6000 skips that fragment and proceeds directly to:
prec = n < 0 ? -1 : n;
goto reswitch;
so that it ignores the precision specification. This appears to be an
error in the generated code. I have not tried to check the assembly output
itself. As I stated in the original report, I am using gcc-2.3.2 for both
the Sun and RS/6000 tests. gdb call and traceback information follows.
David
(Disclaimer: I do not speak for IBM and it does not speak for me.)
Sun call and traceback:
__outfloat (value=5.5, sb=0xf7fff150, type=102, width=0, precision=2, flags=0,
sign_mode=0 '\000', fill=32 ' ') at outfloat.C:31
31 int count = 0;
(gdb) where
#0 __outfloat (value=5.5, sb=0xf7fff150, type=102, width=0, precision=2,
flags=0, sign_mode=0 '\000', fill=32 ' ') at outfloat.C:31
#1 0xb8d8 in streambuf::vform (this=0xf7fff150, fmt0=0x0,
ap=0xf7fff90c "@\031") at sbufvform.C:339
#2 0xb40c in help_vform (sb=0x1a9a4, fmt0=0x4fb0 "%.2f+%.2f = %4.3e\n%n",
ap=0xf7fff904 "@\026") at sbufvform.C:86
#3 0xb4bc in streambuf::vform (this=0x1a9a4,
fmt0=0x4fb0 "%.2f+%.2f = %4.3e\n%n", ap=0xf7fff904 "@\026")
at sbufvform.C:200
#4 0xa6dc in ostream::form (this=0x1a3bc,
format=0x4fb0 "%.2f+%.2f = %4.3e\n%n") at iostream.C:638
#5 0x5060 in t11 () at tFile.C:423
#6 0x52e0 in main (argc=0, argv=0xf7fffa34) at tFile.C:460
(gdb)
RS/6000 call and traceback:
__outfloat (value=5.5, sb=0x2ff7f778, type=102 'f', width=0, precision=6,
flags=0, sign_mode=0 '\000', fill=536870912) at outfloat.C:31
31 int count = 0;
(gdb) where
#0 __outfloat (value=5.5, sb=0x2ff7f778, type=102 'f', width=0, precision=6,
flags=0, sign_mode=0 '\000', fill=536870912) at outfloat.C:31
#1 0x10013270 in streambuf::vform (this=<unknown struct>,
fmt0=0x10018a58 "%.2f+%.2f = %4.3e\n%n", ap=0x2ff7fa28 "@\031")
at sbufvform.C:339
#2 0x10012e1c in help_vform (sb=<unknown struct>,
fmt0=0x10018a58 "%.2f+%.2f = %4.3e\n%n", ap=0x2ff7fa20 "@\026")
at sbufvform.C:86
#3 0x10012eac in streambuf::vform (this=<unknown struct>,
fmt0=0x10018a58 "%.2f+%.2f = %4.3e\n%n", ap=0x2ff7fa20 "@\026")
at sbufvform.C:200
#4 0x10006ed4 in ostream::form (this=0x20051fa4,
format=0x10018a58 "%.2f+%.2f = %4.3e\n%n") at streambuf.h:5
#5 0x10002a6c in t11 () at tFile.C:423
#6 0x10002c80 in main (argc=1, argv=0x2ff7faf0) at tFile.C:460
#7 0x1000042c in __start ()
(gdb)
===============================================================================
David Edelsohn T.J. Watson Research Center
c$dje@watson.ibm.com P.O. Box 218
+1 914 945 3011 (Tieline 862) Yorktown Heights, NY 10598
"The Church doesn't have problems with sex; the world does" -- Vatican official
"A good theory should fit on a T-shirt" -- Astronomer at Jan 1992 AAS meeting
Technical Details
Message-ID:
<9212222231.AA04988@tweetie.watson.ibm.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!watson.ibm.com!c$djeShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.lib.bug Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!watson.ibm.com!c$dje From: c$dje@watson.ibm.com (David Edelsohn) Subject: Re: libg++-2.3 build problems under AIX-3.2 Message-ID: <9212222231.AA04988@tweetie.watson.ibm.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 22 Dec 1992 22:31:31 GMT Approved: bug-lib-g++@prep.ai.mit.edu Lines: 85