1  /* Area:	ffi_call
       2     Purpose:	Check return value float, with many arguments
       3     Limitations:	none.
       4     PR:		none.
       5     Originator:	From the original ffitest.c  */
       6  
       7  /* { dg-do run } */
       8  #include "ffitest.h"
       9  
      10  #include <stdlib.h>
      11  #include <float.h>
      12  #include <math.h>
      13  
      14  static float ABI_ATTR many(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13)
      15  {
      16  #if 0
      17    printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n",
      18  	 (double) f1, (double) f2, (double) f3, (double) f4, (double) f5, 
      19  	 (double) f6, (double) f7, (double) f8, (double) f9, (double) f10,
      20  	 (double) f11, (double) f12, (double) f13);
      21  #endif
      22  
      23    return f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13;
      24  }
      25  
      26  int main (void)
      27  {
      28    ffi_cif cif;
      29    ffi_type *args[13];
      30    void *values[13];
      31    float fa[13];
      32    float f, ff;
      33    int i;
      34  
      35    for (i = 0; i < 13; i++)
      36      {
      37        args[i] = &ffi_type_float;
      38        values[i] = &fa[i];
      39        fa[i] = (float) i;
      40      }
      41  
      42      /* Initialize the cif */
      43      CHECK(ffi_prep_cif(&cif, ABI_NUM, 13,
      44  		       &ffi_type_float, args) == FFI_OK);
      45  
      46      ffi_call(&cif, FFI_FN(many), &f, values);
      47  
      48      ff =  many(fa[0], fa[1],
      49  	       fa[2], fa[3],
      50  	       fa[4], fa[5],
      51  	       fa[6], fa[7],
      52  	       fa[8], fa[9],
      53  	       fa[10],fa[11],fa[12]);
      54  
      55      if (fabs(f - ff) < FLT_EPSILON)
      56        exit(0);
      57      else
      58        abort();
      59  }