[PATCH] D14171: [ELF2] merge-string.s test fixed for win32 configuraton.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 29 04:57:29 PDT 2015


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.

I noticed that merge-string.s test fails under win32/vs2015 configuration. Patch fixes it, below are some details:

size_t is declared as:
typedef unsigned int     size_t;
for that case.

When it was assigned to:
OutputOffset = Builder.add(Entry);
it value was 0xFFFFFFFF and not 0xFFFFFFFFFFFFFFFF like it supposed to be, but then it was added to offsets list:
S->Offsets.push_back(std::make_pair(Offset, OutputOffset));
where its value was converted to 0x00000000ffffffff since Offsets is a list of pairs: std::pair<uintX_t, uintX_t>

Later in code the next comparsion happened:
if (Base != uintX_t(-1)) //And it was not equal to -1 here as was expected
    return Base + Addend; //This return worked when it should not.


http://reviews.llvm.org/D14171

Files:
  ELF/OutputSections.cpp

Index: ELF/OutputSections.cpp
===================================================================
--- ELF/OutputSections.cpp
+++ ELF/OutputSections.cpp
@@ -793,7 +793,7 @@
       if (End == StringRef::npos)
         error("String is not null terminated");
       StringRef Entry = Data.substr(0, End + EntSize);
-      size_t OutputOffset = Builder.add(Entry);
+      uintX_t OutputOffset = Builder.add(Entry);
       if (shouldTailMerge())
         OutputOffset = -1;
       S->Offsets.push_back(std::make_pair(Offset, OutputOffset));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14171.38724.patch
Type: text/x-patch
Size: 536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151029/ce934170/attachment.bin>


More information about the llvm-commits mailing list