Warn pointer to signed integer cast for ilp32
[official-gcc.git] / gcc / testsuite / gcc.dg / pr34263.c
blobd389eade88e4c9144823177bd72fcf01874280ef
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3 /* Same test as 990128-1.c. */
5 extern int printf (const char *,...);
6 extern void abort (void);
8 struct s { struct s *n; } *p;
9 struct s ss;
10 #define MAX 10
11 struct s sss[MAX];
12 int count = 0;
14 void sub( struct s *p, struct s **pp );
15 int look( struct s *p, struct s **pp );
17 main()
19 struct s *pp;
20 struct s *next;
21 int i;
23 p = &ss;
24 next = p;
25 for ( i = 0; i < MAX; i++ ) {
26 next->n = &sss[i];
27 next = next->n;
29 next->n = 0;
31 sub( p, &pp );
32 if (count != MAX+2)
33 abort ();
35 return( 0 );
38 void sub( struct s *p, struct s **pp )
40 for ( ; look( p, pp ); ) {
41 if ( p )
42 p = p->n;
43 else
44 break;
48 int look( struct s *p, struct s **pp )
50 for ( ; p; p = p->n )
52 *pp = p;
53 count++;
54 return( 1 );
57 /* { dg-final { scan-tree-dump "Cleaned-up latch block of loop with single BB" "optimized" { xfail { *-*-* } } } } */
58 /* { dg-final { cleanup-tree-dump "optimized" } } */