Hi @llvm, building a debug version under MSVC 9 leads to a compiler error due to a mix of different types in a call to upper_bound. I have attached a hot-fix but I'm rather unsure if it should be applied as it is, since IMHO the reason is a MSVC library bug ("IMHO", because I don't know the requirements imposed to the predicate by the standard). Best regards Olaf Krzikalla Index: lib/CodeGen/LiveInterval.cpp ==================================================================--- lib/CodeGen/LiveInterval.cpp (revision 127221) +++ lib/CodeGen/LiveInterval.cpp (working copy) @@ -39,6 +39,9 @@ bool operator()(const LiveRange &A, SlotIndex B) const { return A.end < B; } + bool operator()(const LiveRange &A, const LiveRange &B) const { + return A.end < B.end; + } }; }
Olaf Krzikalla <Olaf.Krzikalla at tu-dresden.de> writes:> Hi @llvm, > > building a debug version under MSVC 9 leads to a compiler error due to a > mix of different types in a call to upper_bound. I have attached a > hot-fix but I'm rather unsure if it should be applied as it is, since > IMHO the reason is a MSVC library bug ("IMHO", because I don't know the > requirements imposed to the predicate by the standard).I think that the original author just missed a `const'. Fixed in r127245.
On Mar 8, 2011, at 1:07 AM, Olaf Krzikalla wrote:> Hi @llvm, > > building a debug version under MSVC 9 leads to a compiler error due to a > mix of different types in a call to upper_bound. I have attached a > hot-fix but I'm rather unsure if it should be applied as it is, since > IMHO the reason is a MSVC library bug ("IMHO", because I don't know the > requirements imposed to the predicate by the standard).I hoped the symmetric methods would be enough to trick MSVC into compiling it. Is that extra method getting called? What happens if you stick assert(0) in there?> > Index: lib/CodeGen/LiveInterval.cpp > ==================================================================> --- lib/CodeGen/LiveInterval.cpp (revision 127221) > +++ lib/CodeGen/LiveInterval.cpp (working copy) > @@ -39,6 +39,9 @@ > bool operator()(const LiveRange &A, SlotIndex B) const { > return A.end < B; > } > + bool operator()(const LiveRange &A, const LiveRange &B) const { > + return A.end < B.end; > + } > }; > } > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Mar 8, 2011, at 1:07 AM, Olaf Krzikalla wrote:> Hi @llvm, > > building a debug version under MSVC 9 leads to a compiler error due to a > mix of different types in a call to upper_bound. I have attached a > hot-fix but I'm rather unsure if it should be applied as it is, since > IMHO the reason is a MSVC library bug ("IMHO", because I don't know the > requirements imposed to the predicate by the standard).Thanks, applied as r127264. Does it pass the unit tests with the patch? /jakob
Hi @llvm, Am 08.03.2011 20:14, schrieb Jakob Stoklund Olesen:> Is that extra method getting called? What happens if you stick assert(0) in there?That won't work either (that is, the assert fires). In debug mode the MSVC lib tries to test the ordering of the sequence. And it uses the yielded predicate for this (which in this particular case is a very bad idea).> I hoped the symmetric methods would be enough to trick MSVC into compiling it.Does that mean, that gcc actually only needs bool operator()(const LiveRange&A, SlotIndex B) ? According to C++(2003) 25.0.0.8 the answer is "yes", however that section talks about BinaryPredicate and not Compare. The standard is rather unclear at this point and I'm going over to comp.std.c++ to ask. Best regards Olaf Krzikalla