[LLVMdev] Compiler error: LoopStrengthReduce.cpp

Dale Johannesen dalej at apple.com
Tue May 12 16:01:45 PDT 2009


On May 12, 2009, at 3:09 PMPDT, OvermindDL1 wrote:

> The error given:
>
> ..\..\..\..\trunk\lib\Transforms\Scalar\LoopStrengthReduce.cpp(1016) :
> error C2668: 'abs' : ambiguous call to overloaded function
>
> It should be rather obvious from the message.  The error is in
> LoopStrengthReduce.cpp on line 1016:
>          (unsigned(abs(SInt)) < SSInt || (SInt % SSInt) != 0))
>
>> From looking at the code and what it looks like it should be doing, I
> cannot really tell whether it should use the 32-bit override, or if it
> should use something like the long double override, considering this
> is a 64-bit integer.

It should be a 64-bit integer abs, although gcc seems to be generating  
code for 32-bit integer (which, in this code, would give the expected  
answer in any reasonable example).  There are 4 occurrences of this  
usage in that file (with 3 different authors) so I think we need to  
write one; apparently nobody realized there wasn't one in the standard  
libraries (I didn't either).

> Either way, will not compile until a specific type override is given
> of the form (just an example, I do not know if the 32-bit version is
> what is wanted here):
>          (unsigned(abs((int)SInt)) < SSInt || (SInt % SSInt) != 0))
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list