public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30711]  New: Ifstream bug using Red Hat g++-4.1.0 compared to g++-4.0.2
@ 2007-02-06 10:04 steigers at phys dot ethz dot ch
  2007-02-06 10:05 ` [Bug c++/30711] " steigers at phys dot ethz dot ch
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: steigers at phys dot ethz dot ch @ 2007-02-06 10:04 UTC (permalink / raw)
  To: gcc-bugs

When an ifstream object is used in several open()-close() cycles, it seems to
remember past cycles in the Red Hat gcc version.

STEPS TO REPRODUCE:
1) Compile the attached code using gcc version 4.1.0 20060515 (Red Hat
4.1.0-18)
2) Compile the attached code using gcc version 4.0.2
3) Create a file named "filetest.mat" in the directory where you exectude the
binaries
4) Compare the results: They are different

ACTUAL RESULTS: (Output from program compiled with gcc 4.1.0 20060515 (Red Hat
4.1.0-18))
------------------------------------------------------
Try 1: ifstream-declaration outside loop (not working)
could not open file ./not_existing_directory/filetest.mat
could not open file ./filetest.mat
------------------------------------------------------
Try 2: ifstream-declaration inside loop (working)
could not open file ./not_existing_directory/filetest.mat
could open file ./filetest.mat
------------------------------------------------------

EXPECTED RESULTS: (Output from program compiled with gcc 4.0.2)
------------------------------------------------------
Try 1: ifstream-declaration outside loop (not working)
could not open file ./not_existing_directory/filetest.mat
could open file ./filetest.mat
------------------------------------------------------
Try 2: ifstream-declaration inside loop (working)
could not open file ./not_existing_directory/filetest.mat
could open file ./filetest.mat
------------------------------------------------------

BUILD INFOS:

Faulty version:
---------------
gcc version 4.1.0 20060515 (Red Hat 4.1.0-18)
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --with-gxx-include-dir=/usr/include/c++/3.4.3
--enable-libgcj-multifile --enable-languages=c,c++,java,f95
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=x86_64-redhat-linux
Thread model: posix

Working version:
----------------
gcc version 4.0.2
Reading specs from
/usr/pack/gcc-4.0.2-mo/amd64-debian-linux3.1/lib/gcc/x86_64-unknown-linux-gnu/4.0.2/specs
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr/pack/gcc-4.0.2-mo
--exec-prefix=/usr/pack/gcc-4.0.2-mo/amd64-debian-linux3.1
--with-gxx-include-dir=/usr/pack/gcc-4.0.2-mo/include/c++ --disable-nls
--enable-languages=c,c++,f95
Thread model: posix


-- 
           Summary: Ifstream bug using Red Hat g++-4.1.0 compared to g++-
                    4.0.2
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steigers at phys dot ethz dot ch


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30711


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/30711] Ifstream bug using Red Hat g++-4.1.0 compared to g++-4.0.2
  2007-02-06 10:04 [Bug c++/30711] New: Ifstream bug using Red Hat g++-4.1.0 compared to g++-4.0.2 steigers at phys dot ethz dot ch
@ 2007-02-06 10:05 ` steigers at phys dot ethz dot ch
  2007-02-06 10:33 ` steigers at phys dot ethz dot ch
  2007-02-06 19:32 ` [Bug libstdc++/30711] " pcarlini at suse dot de
  2 siblings, 0 replies; 4+ messages in thread
From: steigers at phys dot ethz dot ch @ 2007-02-06 10:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from steigers at phys dot ethz dot ch  2007-02-06 10:05 -------
Created an attachment (id=13012)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13012&action=view)
Code for testing the bug


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30711


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/30711] Ifstream bug using Red Hat g++-4.1.0 compared to g++-4.0.2
  2007-02-06 10:04 [Bug c++/30711] New: Ifstream bug using Red Hat g++-4.1.0 compared to g++-4.0.2 steigers at phys dot ethz dot ch
  2007-02-06 10:05 ` [Bug c++/30711] " steigers at phys dot ethz dot ch
@ 2007-02-06 10:33 ` steigers at phys dot ethz dot ch
  2007-02-06 19:32 ` [Bug libstdc++/30711] " pcarlini at suse dot de
  2 siblings, 0 replies; 4+ messages in thread
From: steigers at phys dot ethz dot ch @ 2007-02-06 10:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from steigers at phys dot ethz dot ch  2007-02-06 10:33 -------
Apparently if the close() statement is followed by a clear() statement it
works. I t also works if close() is omitted and only clear() is called.

I therefore suspect that someone forgot to change the status of the stream in
the open() method of the fulty compiler.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30711


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/30711] Ifstream bug using Red Hat g++-4.1.0 compared to g++-4.0.2
  2007-02-06 10:04 [Bug c++/30711] New: Ifstream bug using Red Hat g++-4.1.0 compared to g++-4.0.2 steigers at phys dot ethz dot ch
  2007-02-06 10:05 ` [Bug c++/30711] " steigers at phys dot ethz dot ch
  2007-02-06 10:33 ` steigers at phys dot ethz dot ch
@ 2007-02-06 19:32 ` pcarlini at suse dot de
  2 siblings, 0 replies; 4+ messages in thread
From: pcarlini at suse dot de @ 2007-02-06 19:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pcarlini at suse dot de  2007-02-06 19:32 -------
I cannot reproduce the issue on official FSF compiler more recent than gcc4.0.0
(note that vendor releases are not supported here, sorry). In fact, since that
release we are implementing the resolution of DR 409:

  http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#409

which implies that an user-code clear after a failed open is not necessary
anymore. Also note that, in general, if you are not sure about the
implementation of DR 409 in a given library, portable code should always call
clear after a failed open (of course, constructing a new fstream, as per your
Try 2, always works).


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c++                         |libstdc++
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30711


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-06 19:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-06 10:04 [Bug c++/30711] New: Ifstream bug using Red Hat g++-4.1.0 compared to g++-4.0.2 steigers at phys dot ethz dot ch
2007-02-06 10:05 ` [Bug c++/30711] " steigers at phys dot ethz dot ch
2007-02-06 10:33 ` steigers at phys dot ethz dot ch
2007-02-06 19:32 ` [Bug libstdc++/30711] " pcarlini at suse dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).