On Sat, Oct 26, 2013 at 10:36 PM, Manav Bhatia <[email protected]>wrote:

> Good to know about this!
>
> I did a bit of digging into it, and the problem seems to be coming after
> the call to istr.unget() at line 990 in GetPot::_skip_whitespace(). For
> some reason, it seems to corrupt the istream data structure so that
> std::cout << istr   prints false.
>
> Using istream::unget() seems to work OK outside of GetPot. Also, I
> downloaded GetPot from its website and get the same issue.
>
> I do not know why this is happening. Perhaps a bug with clang 5, or maybe
> something about how GetPot does things.
>

I agree with your assessment.  In lldb (debugger for llvm/clang),
istr.good() == true immediately prior to line 990 and istr.good() == false
immediately following it.

One possible problem I can see with the getpot code: is it legal C++ to
call unget() immediately after a call to seekg or is it possibly invoking
undefined behavior?

Second: I'm not sure I even understand the logic of what's going on here.
 You save "Pos", then if the current character is _not_ a comment
character, seekg(Pos) and immediately call istr.unget().  I don't see the
point of tellg()/seekg() here because you could not have moved the cursor
in the interim.  I commented out these lines and it fixed my test code and
adjoints_ex3.  I'm running the rest of the libmesh examples now and will
commit if they all pass.

Would you and Subramanya mind testing apple clang again after I patch
getpot and let me know if it works for you?

-- 
John
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to