r254574 - PR17381: Treat undefined behavior during expression evaluation as an unmodeled

Robinson, Paul via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 9 10:17:12 PST 2015


| And at runtime, on some targets, we use this:
|
|  https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/builtins/floatuntisf.c
|
| ... which gives a NaN in this case.

I copied that function into a test program on Ubuntu, built with gcc, and it gives me +Infinity (0x7f800000) not NaN (0x7fc00000).
--paulr

From: metafoo at gmail.com [mailto:metafoo at gmail.com] On Behalf Of Richard Smith
Sent: Tuesday, December 08, 2015 11:42 AM
To: Robinson, Paul
Cc: Joerg Sonnenberger; cfe-commits (cfe-commits at lists.llvm.org)
Subject: Re: r254574 - PR17381: Treat undefined behavior during expression evaluation as an unmodeled

On Tue, Dec 8, 2015 at 11:18 AM, Richard Smith <richard at metafoo.co.uk<mailto:richard at metafoo.co.uk>> wrote:
On Tue, Dec 8, 2015 at 10:59 AM, Robinson, Paul <Paul_Robinson at playstation.sony.com<mailto:Paul_Robinson at playstation.sony.com>> wrote:
Okay, I'll bite:  so what *does* UINT128_MAX actually convert to?

$ echo 'unsigned __int128 max = -1; float f = max;' | ~/clang-8/build/bin/clang -x c++ - -emit-llvm -S -o - -O3 | grep @f
@f = global float undef, align 4

And at runtime, on some targets, we use this:

  https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/builtins/floatuntisf.c

... which gives a NaN in this case.

From: cfe-commits [mailto:cfe-commits-bounces at lists.llvm.org<mailto:cfe-commits-bounces at lists.llvm.org>] On Behalf Of Richard Smith via cfe-commits
Sent: Tuesday, December 08, 2015 10:52 AM
To: Joerg Sonnenberger; cfe-commits
Subject: Re: r254574 - PR17381: Treat undefined behavior during expression evaluation as an unmodeled

On Tue, Dec 8, 2015 at 2:13 AM, Joerg Sonnenberger via cfe-commits <cfe-commits at lists.llvm.org<mailto:cfe-commits at lists.llvm.org>> wrote:
On Mon, Dec 07, 2015 at 01:32:14PM -0800, Richard Smith via cfe-commits wrote:
> C11 6.3.1.5/1<http://6.3.1.5/1>: "If the value being converted is outside the range of values
> that can be represented, the behavior is undefined."

The value of 1e100 can be represented as +inf, even if not precisely.

Only if +inf is in the range of representable values, which, as already noted, is problematic.

This is a bit different from non-IEEE math like VAX, that doesn't have
infinities.

Joerg
_______________________________________________
cfe-commits mailing list
cfe-commits at lists.llvm.org<mailto:cfe-commits at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151209/2867bdd2/attachment-0001.html>


More information about the cfe-commits mailing list