This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Analysis of libstdc++/2071 test case


On Wed, May 09, 2001 at 01:56:30AM -0500, Loren James Rittle wrote:
> #include <errno.h>
> #include <stdio.h>
> 
> int main ()
> {
>   char buf;
>   char buf2;
>   int error = 0;
> 
>   fread (&buf, 1, 1, stdin);
>   fseek (stdin, 0, SEEK_CUR);
>   fread (&buf2, 1, 1, stdin);
> 
>   printf ("%d %d %d\n", buf, buf2, error);
> }
> 
> When run on Red Hat Linux 6.1 (Cartman) (with whatever glibc was the default):
> 
> ; a.out
> 1234<CR>
> 1 2
[...]

With glibc-2.2, I get (on a linux box that is mostly rawhide-1.0):

~>g++-2.95.1 -g test.cc
~>a.out
1234
49 50 0
~>g++-2.95.2 -g test.cc
~>a.out
1234
49 50 0
~>g++-2.95.3 -g test.cc
~>a.out
1234
49 50 0
~>g++-2.96 -g test.cc
~>a.out
1234
49 50 0
~>g++-3.0 -g test.cc
~>a.out
1234
49 50 0
~>g++-3.1 -g test.cc
~>a.out
1234
49 50 0

An output of "1 2" seems highly unlikely, it should be "49 50 0".

-- 
Carlo Wood <carlo@alinoe.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]