[LLVMbugs] [Bug 17688] New: std::getline does not read data after calling ifstream::clear() (Mavericks)
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Oct 24 12:37:56 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=17688
Bug ID: 17688
Summary: std::getline does not read data after calling
ifstream::clear() (Mavericks)
Product: libc++
Version: unspecified
Hardware: PC
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: hhinnant at apple.com
Reporter: bernhard at icsi.berkeley.edu
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 11423
--> http://llvm.org/bugs/attachment.cgi?id=11423&action=edit
readline behavior demonstration
The following program demonstrates an inconsistency in std::getline behavior
between libc++ and libstdc++ (using clang3.3).
The program opens the file testfile, reads it until eof, then clears the error
bits using ifstream::clear and tries to read from the same filehandle again to
see if new data was appended to the file.
Using libstdc++ (no matter which compiler), if you append data to testfile
while the program is running, the data will be read by the getline call in the
next loop iteration.
In clang 3.3 on OS-X with libc++, after the first time the file end is
encountered, getline will always fail and set the eof bit on all following
calls, without reading any data that has been appended to the file.
Uncommenting the workaround, which just seeks to the current position restores
libstdc++ behavior. Compiling against libstdc++ with clang++ -stdlib=libstdc++
also reverts to the old behavior.
Is expected behavior? Am I trying to do this in a way that is not supported or
is this some problem of current libc++ versions?
The clang version that triggers this behavior for me is the most recent one
shipped with XCode for Mavericks:
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
The libc++ library that is linked against has this version information:
/usr/lib/libc++.1.dylib:
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 48.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
1197.1.1)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131024/bf1572af/attachment.html>
More information about the llvm-bugs
mailing list