This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/3141: DR 243: basic_istream::get and getline when sentry reports failure
- To: gcc-gnats at gcc dot gnu dot org
- Subject: libstdc++/3141: DR 243: basic_istream::get and getline when sentry reports failure
- From: theonetruekenny at yahoo dot com
- Date: 12 Jun 2001 17:19:41 -0000
- Cc: kenny dot simpson at gs dot com
- Reply-To: theonetruekenny at yahoo dot com
>Number: 3141
>Category: libstdc++
>Synopsis: DR 243: basic_istream::get and getline when sentry reports failure
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jun 12 10:26:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: theonetruekenny@yahoo.com
>Release: 20010612 cvs
>Organization:
>Environment:
source
>Description:
see
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#243
>How-To-Repeat:
observe istream::get(char_type* __s, streamsize __n, char_type __delim)
in line 536 of include/bits/istream.tcc
note that on line 573: *__s = char_type(NULL);
observe istream::getline(char_type* __s, streamsize __n, char_type __delim)
in line 627 of include/bits/istream.tcc
note on line 673: *__s = char_type(NULL);
>Fix:
as per DR 243,
i.e.:
before the sentry construction in both the functions, add:
if( __n ) *s == char_type(); // same as charT() as specified in the DR 243
change the existing *__s = char_type(NULL)'s in 573/673 to
*s == char_type(); and move then inside the body of the if's on lines
540 and 631.
The condition in the if() on line 631 should be changed to match that
of the if() on line 540.
>Release-Note:
>Audit-Trail:
>Unformatted: