sigbus.c (50a75ff680ec8999baa0bffc49af8c6ad5c0035a) | sigbus.c (6a6f4295748030e302a5768c5098a484d25a5b12) |
---|---|
1#define _GNU_SOURCE 1 2 3#include <assert.h> 4#include <stdlib.h> 5#include <signal.h> 6#include <endian.h> 7 8 | 1#define _GNU_SOURCE 1 2 3#include <assert.h> 4#include <stdlib.h> 5#include <signal.h> 6#include <endian.h> 7 8 |
9unsigned long long x = 0x8877665544332211ull; 10void * volatile p = (void *)&x + 1; | 9char x[32] __attribute__((aligned(16))) = { 10 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 11 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 12 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 13 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 14}; 15void * volatile p = (void *)&x + 15; |
11 12void sigbus(int sig, siginfo_t *info, void *uc) 13{ 14 assert(sig == SIGBUS); 15 assert(info->si_signo == SIGBUS); 16#ifdef BUS_ADRALN 17 assert(info->si_code == BUS_ADRALN); 18#endif --- 36 unchanged lines hidden (view full) --- 55 56 assert(allow_fail); 57 58 /* 59 * We didn't see a signal. 60 * We might as well validate the unaligned load worked. 61 */ 62 if (BYTE_ORDER == LITTLE_ENDIAN) { | 16 17void sigbus(int sig, siginfo_t *info, void *uc) 18{ 19 assert(sig == SIGBUS); 20 assert(info->si_signo == SIGBUS); 21#ifdef BUS_ADRALN 22 assert(info->si_code == BUS_ADRALN); 23#endif --- 36 unchanged lines hidden (view full) --- 60 61 assert(allow_fail); 62 63 /* 64 * We didn't see a signal. 65 * We might as well validate the unaligned load worked. 66 */ 67 if (BYTE_ORDER == LITTLE_ENDIAN) { |
63 assert(tmp == 0x55443322); | 68 assert(tmp == 0x13121110); |
64 } else { | 69 } else { |
65 assert(tmp == 0x77665544); | 70 assert(tmp == 0x10111213); |
66 } 67 return EXIT_SUCCESS; 68} | 71 } 72 return EXIT_SUCCESS; 73} |