1 /* Copyright (C) 2009 Free Software Foundation, Inc.
2 
3    This file is free software; you can redistribute it and/or modify it under
4    the terms of the GNU General Public License as published by the Free
5    Software Foundation; either version 3 of the License, or (at your option)
6    any later version.
7 
8    This file is distributed in the hope that it will be useful, but WITHOUT
9    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11    for more details.
12 
13    You should have received a copy of the GNU General Public License
14    along with this file; see the file COPYING3.  If not see
15    <http://www.gnu.org/licenses/>.  */
16 
17 /* Make sure __ea structure references work.  */
18 
19 /* { dg-do compile } */
20 
21 typedef unsigned long int uintptr_t;
22 
23 struct tostruct
24 {
25   uintptr_t selfpc;
26   long count;
27   unsigned short link;
28 };
29 
30 /* froms are indexing tos */
31 static __ea unsigned short *froms;
32 static __ea struct tostruct *tos = 0;
33 
34 void
foo(uintptr_t frompc,uintptr_t selfpc)35 foo (uintptr_t frompc, uintptr_t selfpc)
36 {
37   __ea unsigned short *frompcindex;
38 
39   frompcindex = &froms[(frompc) / (4 * sizeof (*froms))];
40   *frompcindex = tos[0].link;
41 
42   return;
43 }
44