<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div style="font-family: Verdana;font-size: 12.0px;">
<div>
<div>Hi guys,</div>

<div>depending on your patch idea I wrote a small (fast and dirty) workaround until the problem is solved.</div>

<div> </div>

<div>
<div>--- D:\Datenkrake\llvm_14_06_02\MemoryBuffer.cpp    2014-06-02 06:34:10.000000000 +-0200<br/>
+++ D:\Datenkrake\llvm_14_06_02\lib\Support\MemoryBuffer.cpp    2014-06-02 09:41:57.000000000 +-0200<br/>
@@ -192,13 +192,20 @@<br/>
   MemoryBufferMMapFile(bool RequiresNullTerminator, int FD, uint64_t Len,<br/>
                        uint64_t Offset, error_code EC)<br/>
       : MFR(FD, false, sys::fs::mapped_file_region::readonly,<br/>
             getLegalMapSize(Len, Offset), getLegalMapOffset(Offset), EC) {<br/>
     if (!EC) {<br/>
       const char *Start = getStart(Len, Offset);<br/>
-      init(Start, Start + Len, RequiresNullTerminator);<br/>
+      if (RequiresNullTerminator && ((Start + Len)[0] != 0))<br/>
+      {<br/>
+        EC.assign(42, system_category());<br/>
+      }<br/>
+      else<br/>
+      {<br/>
+          init(Start, Start + Len, RequiresNullTerminator);<br/>
+      }<br/>
     }<br/>
   }<br/>
 <br/>
   const char *getBufferIdentifier() const override {<br/>
     // The name is stored after the class itself.<br/>
     return reinterpret_cast<const char *>(this + 1);</div>

<div> </div>

<div>On the one hand I don't know how EC is actually working. How to make it right?</div>

<div>On the other hand I also don't know if this patch will lead to problems.</div>

<div> </div>

<div>The reason why I just changed EC is that in getOpenFileImpl on the place where is checked shouldUseMmap is checked after the mmap stuff if EC is non-zero.</div>

<div> </div>

<div>In my testruns this patch solves the problem with the non-zero buffer end but I receive a new failed assertion:</div>

<div>
<div>File: d:/Datenkrake/llvm_14_06_02/tools/clang/lib/Basic/SourceManager.cpp, Line 592</div>

<div>Expression: NextLocalOffset + FileSize + 1 > NextLocalOffset && NextLocalOffset + FileSize + 1 <= CurrentLoadedOffset && "Ran out of source locations!"</div>

<div> </div>

<div>This assertion fails usually after the error message "modified since it was first processed".</div>

<div>Is this because of my patch that he not cleanup properly or is it just another error in IBMs MVFS</div>

<div> </div>

<div>Best,</div>

<div>Robert</div>

<div> </div>

<div>PS: sry Rafael the first version of this mail was sent just to you.</div>
</div>
</div>

<div> 
<div style="margin: 10.0px 5.0px 5.0px 10.0px;padding: 10.0px 0 10.0px 10.0px;border-left: 2.0px solid rgb(195,217,229);">
<div style="margin: 0 0 10.0px 0;"><b>Gesendet:</b> Mittwoch, 28. Mai 2014 um 07:07 Uhr<br/>
<b>Von:</b> "Rafael Espíndola" <rafael.espindola@gmail.com><br/>
<b>An:</b> tsett <tsett@gmx.net><br/>
<b>Cc:</b> "clang-dev Developers" <cfe-dev@cs.uiuc.edu><br/>
<b>Betreff:</b> Re: [cfe-dev] Not null terminated file</div>

<div>On 27 May 2014 15:54, tsett <tsett@gmx.net> wrote:<br/>
> This sounds good to me. Especially for the check of the last byte.<br/>
> Should I report my issue there too?<br/>
<br/>
I think the bug covers it, no?<br/>
<br/>
If you have more information you want to add to the bug, pleas do.<br/>
<br/>
Cheers,<br/>
Rafael</div>
</div>
</div>
</div>
</div></div></body></html>