modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/20021118-2.c (about)

     1  /* Originally added to test SH constant pool layout.  t1() failed for
     2     non-PIC and t2() failed for PIC.  */
     3  
     4  int t1 (float *f, int i,
     5  	void (*f1) (double),
     6  	void (*f2) (float, float))
     7  {
     8    f1 (3.0);
     9    f[i] = f[i + 1];
    10    f2 (2.5f, 3.5f);
    11  }
    12  
    13  int t2 (float *f, int i,
    14  	void (*f1) (double),
    15  	void (*f2) (float, float),
    16  	void (*f3) (float))
    17  {
    18    f3 (6.0f);
    19    f1 (3.0);
    20    f[i] = f[i + 1];
    21    f2 (2.5f, 3.5f);
    22  }
    23  
    24  void f1 (double d)
    25  {
    26    if (d != 3.0)
    27      abort ();
    28  }
    29  
    30  void f2 (float f1, float f2)
    31  {
    32    if (f1 != 2.5f || f2 != 3.5f)
    33      abort ();
    34  }
    35  
    36  void f3 (float f)
    37  {
    38    if (f != 6.0f)
    39      abort ();
    40  }
    41  
    42  int main ()
    43  {
    44    float f[3] = { 2.0f, 3.0f, 4.0f };
    45    t1 (f, 0, f1, f2);
    46    t2 (f, 1, f1, f2, f3);
    47    if (f[0] != 3.0f && f[1] != 4.0f)
    48      abort ();
    49    exit (0);
    50  }