OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20001229-1.c] - Blame information for rev 149

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* This testcase originally provoked an unaligned access fault on Alpha.
2
 
3
   Since Digital Unix and Linux (and probably others) by default fix
4
   these up in the kernel, the failure was not visible unless one
5
   is sitting at the console examining logs.
6
 
7
   So: If we know how, ask the kernel to deliver SIGBUS instead so
8
   that the test case visibly fails.  */
9
 
10
#if defined(__alpha__) && (defined(__linux__) || defined(__osf__))
11
#ifdef __linux__
12
#include <asm/sysinfo.h>
13
#include <asm/unistd.h>
14
 
15
static inline int
16
setsysinfo(unsigned long op, void *buffer, unsigned long size,
17
           int *start, void *arg, unsigned long flag)
18
{
19
  syscall(__NR_osf_setsysinfo, op, buffer, size, start, arg, flag);
20
}
21
 
22
#else
23
#include <sys/sysinfo.h>
24
#include <sys/proc.h>
25
#endif
26
 
27
static void __attribute__((constructor))
28
trap_unaligned(void)
29
{
30
  unsigned int buf[2];
31
  buf[0] = SSIN_UACPROC;
32
  buf[1] = UAC_SIGBUS | UAC_NOPRINT;
33
  setsysinfo(SSI_NVPAIRS, buf, 1, 0, 0, 0);
34
}
35
#endif /* alpha */
36
 
37
void foo(char *a, char *b) { }
38
 
39
void showinfo()
40
{
41
    char uname[33] = "", tty[38] = "/dev/";
42
    foo(uname, tty);
43
}
44
 
45
int main()
46
{
47
  showinfo ();
48
  exit (0);
49
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.