[cfe-dev] __builtin_nan support
Nate Begeman
natebegeman at mac.com
Mon May 19 12:29:36 PDT 2008
On May 19, 2008, at 12:06 PM, Eli Friedman wrote:
> On Mon, May 19, 2008 at 11:02 AM, Nate Begeman <natebegeman at mac.com>
> wrote:
>> Attached patch implements __builtin_nan, __builtin_nanf, and
>> __builtin_nanl.
>
> @@ -58,6 +57,10 @@
> if (SemaBuiltinUnorderedCompare(TheCall.get()))
> return true;
> return TheCall.take();
> + case Builtin::BI__builtin_nan:
> + case Builtin::BI__builtin_nanf:
> + case Builtin::BI__builtin_nanl:
> + return SemaBuiltinNaN(FnInfo->getBuiltinID(), TheCall.get());
> case Builtin::BI__builtin_shufflevector:
> return SemaBuiltinShuffleVector(TheCall.get());
> }
>
> This is unsafe; in the case where SemaBuiltinNaN doesn't find a string
> literal, you end up with a dangling pointer.
Sure enough, need a take vs. get
>
>
> + llvm::APInt Val(64, 0x7ff8000000000000ULL, false);
> +
> + char *endp = 0;
> + uint64_t Significand = strtoull(data, &endp, 0);
>
> Windows doesn't have strtoull.
What's the suggested replacement?
Nate
More information about the cfe-dev
mailing list