Re: Test suite fails on alpha architecture

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Test suite fails on alpha architecture
Дата
Msg-id 28528.1194464663@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Test suite fails on alpha architecture  (Falk Hueffner <falk@debian.org>)
Ответы Re: Test suite fails on alpha architecture  (Steve Langasek <vorlon@debian.org>)
Список pgsql-bugs
Falk Hueffner <falk@debian.org> writes:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>> It looks to me like Debian's compiler must be allowing the division
>> instruction to be speculatively executed before the if-test branch
>> is taken.

> Can you create a stand-alone testcase for this?

I don't have access to a machine on which the failure occurs, but
perhaps Martin can try it.  I'd think it'd be pretty easy, say

#include <stdio.h>
#include <stdlib.h>

void
ereport(const char *msg)
{
    fprintf(stderr, "%s\n", msg);
    exit(0);
}

int
main(int argc, char **argv)
{
    int    arg1 = atoi(argv[1]);
    int    arg2 = atoi(argv[2]);
    int    result;

    if (arg2 == 0)
        ereport("division by zero");

    result = arg1 / arg2;

    printf("%d\n", result);

    return 0;
}


cc -g -O2 -fPIC -fno-strict-aliasing -mieee -D_GNU_SOURCE bug.c
./a.out 1 0

I would not be surprised at all if it's compile-switch dependent; these
look to be the switches Martin tested with.

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Falk Hueffner
Дата:
Сообщение: Re: Test suite fails on alpha architecture
Следующее
От: Steve Langasek
Дата:
Сообщение: Re: Test suite fails on alpha architecture