Skip site navigation (1) Skip section navigation (2)

Re: Test suite fails on alpha architecture

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Falk Hueffner <falk(at)debian(dot)org>
Cc: Steve Langasek <vorlon(at)debian(dot)org>, José Luis Rivero (yoswink) <yoswink(at)gentoo(dot)org>, debian-alpha(at)lists(dot)debian(dot)org, alpha(at)gentoo(dot)org, pgsql-bugs(at)postgresql(dot)org, Martin Pitt <martin(at)piware(dot)de>
Subject: Re: Test suite fails on alpha architecture
Date: 2007-11-07 19:44:23
Message-ID: 28528.1194464663@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Falk Hueffner <falk(at)debian(dot)org> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

pgsql-bugs by date

Next:From: heasleyDate: 2007-11-07 20:20:50
Subject: BUG #3728: pthread autoconf hangs
Previous:From: Steve LangasekDate: 2007-11-07 19:41:51
Subject: Re: Test suite fails on alpha architecture

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group