attn alpha testers

Richard Henderson rth@redhat.com
Tue Feb 5 01:00:00 GMT 2002


While poking at something on the console today, I noticed that
there were a bunch of unaligned traps from gcc test cases.  

Would folks compile this ditty, put it in their path, and do
testing like so:

 unaligned sh -c 'make bootstrap && make check -k'

This should help weed out these kinds of mistakes by forcing
SIGBUS instead of emulating the unaligned access.

Thanks.


r~
-------------- next part --------------
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

#ifndef __linux__
#include <sys/sysinfo.h>
#else
#include <asm/sysinfo.h>
#include <asm/unistd.h>

static inline int
setsysinfo(unsigned long op, void *buffer, unsigned long size,
	   int *start, void *arg, unsigned long flag)
{
  syscall(__NR_osf_setsysinfo, op, buffer, size, start, arg, flag);
}
#endif

static inline void
trap_unaligned(void)
{
  unsigned int buf[2];
  buf[0] = SSIN_UACPROC;
  buf[1] = UAC_SIGBUS | UAC_NOPRINT;
  setsysinfo(SSI_NVPAIRS, buf, 1, 0, 0, 0);
}

int
main(int ac, char **av)
{
  char *sh[2];

  trap_unaligned();

  if (ac <= 1)
    {
      sh[0] = getenv("SHELL");
      if (sh[0] == NULL)
	sh[0] = "/bin/sh";
      sh[1] = NULL;
      av = sh - 1;
    }

  execvp(av[1], av + 1);
  perror(av[1]);
  return 1;
}


More information about the Gcc mailing list