modernc.org/cc@v1.0.1/testdata/gcc-6.3.0/gcc/testsuite/gcc.c-torture/execute/20020529-1.c (about)

     1  /* PR target/6838 from cato@df.lth.se.
     2     cris-elf got an ICE with -O2: the insn matching
     3        (insn 49 48 52 (parallel[ 
     4  		  (set (mem/s:HI (plus:SI (reg/v/f:SI 0 r0 [24])
     5  			      (const_int 8 [0x8])) [5 <variable>.c+0 S2 A8])
     6  		      (reg:HI 2 r2 [27]))
     7  		  (set (reg/f:SI 2 r2 [31])
     8  		      (plus:SI (reg/v/f:SI 0 r0 [24])
     9  			  (const_int 8 [0x8])))
    10  	      ] ) 24 {*mov_sidehi_mem} (nil)
    11  	  (nil))
    12     forced a splitter through the output pattern "#", but there was no
    13     matching splitter.  */
    14  
    15  struct xx
    16   {
    17     int a;
    18     struct xx *b;
    19     short c;
    20   };
    21  
    22  int f1 (struct xx *);
    23  void f2 (void);
    24  
    25  int
    26  foo (struct xx *p, int b, int c, int d)
    27  {
    28    int a;
    29  
    30    for (;;)
    31      {
    32        a = f1(p);
    33        if (a)
    34  	return (0);
    35        if (b)
    36  	continue;
    37        p->c = d;
    38        if (p->a)
    39  	f2 ();
    40        if (c)
    41  	f2 ();
    42        d = p->c;
    43        switch (a)
    44  	{
    45  	case 1:
    46  	  if (p->b)
    47  	    f2 ();
    48  	  if (c)
    49  	    f2 ();
    50  	default:
    51  	  break;
    52  	}
    53      }
    54    return d;
    55  }
    56  
    57  int main (void)
    58  {
    59    struct xx s = {0, &s, 23};
    60    if (foo (&s, 0, 0, 0) != 0 || s.a != 0 || s.b != &s || s.c != 0)
    61      abort ();
    62    exit (0);
    63  }
    64  
    65  int
    66  f1 (struct xx *p)
    67  {
    68    static int beenhere = 0;
    69    if (beenhere++ > 1)
    70      abort ();
    71    return beenhere > 1;
    72  }
    73  
    74  void
    75  f2 (void)
    76  {
    77    abort ();
    78  }