comparison gcc/testsuite/gcc.dg/unaligned-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* PR middle-end/7847 */
2 /* Originator: <jk@tools.de> */
3 /* { dg-do run } */
4
5 /* This used to fail on SPARC at runtime because of
6 an unaligned memory access. */
7
8 typedef char int8_t;
9 typedef short int16_t;
10 typedef int int32_t;
11 typedef unsigned char uint8_t;
12 typedef unsigned short uint16_t;
13 typedef unsigned int uint32_t;
14
15 typedef struct {
16 uint32_t address;
17 uint16_t size;
18 } __attribute__ ((packed)) sml_agl_data_t;
19
20 typedef struct {
21 sml_agl_data_t data[9];
22 } __attribute__ ((packed)) sml_agli_t;
23
24 typedef struct {
25 sml_agli_t sml_agli;
26 } __attribute__ ((packed)) dsi_t;
27
28 typedef struct {
29 int a;
30 dsi_t dsi_pack;
31 } dvd_priv_t;
32
33 int dvd_read_sector(dvd_priv_t *d, unsigned char* data)
34 {
35 int i, skip=0;
36
37 for (i=0; i < 9; i++)
38 if ((skip=d->dsi_pack.sml_agli.data[i].address) != 0)
39 break;
40
41 return skip;
42 }
43
44 int main(void)
45 {
46 static dvd_priv_t dvd_priv;
47 dvd_read_sector(&dvd_priv, 0);
48 return 0;
49 }