modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.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  /* The ptx assembler appears to clobber 'b' inside foo during the f1 call.
    16     Reported to nvidia 2016-05-18.  */
    17  /* { dg-skip-if "PTX assembler bug" { nvptx-*-* } { "-O0" } { "" } } */
    18  
    19  struct xx
    20   {
    21     int a;
    22     struct xx *b;
    23     short c;
    24   };
    25  
    26  int f1 (struct xx *);
    27  void f2 (void);
    28  
    29  int
    30  foo (struct xx *p, int b, int c, int d)
    31  {
    32    int a;
    33  
    34    for (;;)
    35      {
    36        a = f1(p);
    37        if (a)
    38  	return (0);
    39        if (b)
    40  	continue;
    41        p->c = d;
    42        if (p->a)
    43  	f2 ();
    44        if (c)
    45  	f2 ();
    46        d = p->c;
    47        switch (a)
    48  	{
    49  	case 1:
    50  	  if (p->b)
    51  	    f2 ();
    52  	  if (c)
    53  	    f2 ();
    54  	default:
    55  	  break;
    56  	}
    57      }
    58    return d;
    59  }
    60  
    61  int main (void)
    62  {
    63    struct xx s = {0, &s, 23};
    64    if (foo (&s, 0, 0, 0) != 0 || s.a != 0 || s.b != &s || s.c != 0)
    65      abort ();
    66    exit (0);
    67  }
    68  
    69  int
    70  f1 (struct xx *p)
    71  {
    72    static int beenhere = 0;
    73    if (beenhere++ > 1)
    74      abort ();
    75    return beenhere > 1;
    76  }
    77  
    78  void
    79  f2 (void)
    80  {
    81    abort ();
    82  }