https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94035

--- Comment #3 from Alexander Cherepanov <ch3root at openwall dot com> ---
(In reply to jos...@codesourcery.com from comment #2)
> I think pseudo-denormals should be considered trap representations.
Cool!

What about IBM extended double (double-double)? All cases where (double)(hi +
lo) != hi are trap representations too?

But there is one case which you once mentioned as valid -- when the low part is
zero, this zero could be of any sign.

----------------------------------------------------------------------
#include <stdio.h>

__attribute__((noipa)) // imagine it in a separate TU
static long double opaque(long double d) { return d; }

int main()
{
    long double x = -opaque(1);
    unsigned char *px = (unsigned char *)&x;

    if (x == -1)
        printf("px[8] = %d\n", px[8]);
    printf("px[8] = %d\n", px[8]);
}
----------------------------------------------------------------------
$ powerpc64-linux-gnu-gcc -std=c11 -pedantic -Wall -Wextra -O3 test.c &&
qemu-ppc64 /usr/powerpc-linux-gnu/lib64/ld64.so.1 --library-path
/usr/powerpc-linux-gnu/lib64 ./a.out
px[8] = 0
px[8] = 128
----------------------------------------------------------------------
gcc x86-64 version: powerpc64-linux-gnu-gcc (Debian 8.3.0-2) 8.3.0
----------------------------------------------------------------------

Here the low part of x is -0. , px[8] is a byte containing the sign bit of the
low part.

Reply via email to