Avi Cohen Stuart changed bug 933903
What Removed Added
Status RESOLVED REOPENED
Resolution INVALID ---

Comment # 5 on bug 933903 from
Hi,

if I remove the FE_INEXACT and only leave the FE_INVALID I still get a core
dump due to a floating point exception.
Note that you need the memset which messes up with the xmm registers to get
invalid values.

It is not related to the FE_INEXACT.

Avi.

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>
#include <signal.h>
#include <fenv.h>

/* compile with:

gcc t.c -g -o ./t -lm 


*/

int main(int argc, char **argv)
{
    char *buf;
    long    lval;
    double    dval;

    sigset_t sigset;

    sigemptyset(&sigset);
    sigaddset(&sigset, SIGFPE);
    sigprocmask(SIG_UNBLOCK, &sigset, NULL);
    feenableexcept(FE_INVALID);

    buf = malloc(4096);
    /* this memset corrupts a part of xmm0 and fills it with 0xe5 */
    memset(buf, 0xe5, 4096);

    lval = 2;
    /* 
     * in exp() the instruction cvttpd2dq is used using values from
     * xmm0
     * part of the xmm1 cannot convert to a int and raises the exception
     */
    dval = exp( (double) lval );

    return 0;

}


You are receiving this mail because: