Sha256: eb0213894f6562b2cf55520c98c035dd602b1f13d0910010a0a2f33778b8e9e8

Contents?: true

Size: 1.07 KB

Versions: 5923

Compression:

Stored size: 1.07 KB

Contents

/* Area:	ffi_call
   Purpose:	Check return value float.
   Limitations:	none.
   PR:		none.
   Originator:	<andreast@gcc.gnu.org> 20050212  */

/* { dg-do run } */
#include "ffitest.h"

/* Use volatile float to avoid false negative on ix86.  See PR target/323.  */
static float return_fl(float fl1, float fl2, float fl3, float fl4)
{
  volatile float sum;

  sum = fl1 + fl2 + fl3 + fl4;
  return sum;
}
int main (void)
{
  ffi_cif cif;
  ffi_type *args[MAX_ARGS];
  void *values[MAX_ARGS];
  float fl1, fl2, fl3, fl4, rfl;
  volatile float sum;

  args[0] = &ffi_type_float;
  args[1] = &ffi_type_float;
  args[2] = &ffi_type_float;
  args[3] = &ffi_type_float;
  values[0] = &fl1;
  values[1] = &fl2;
  values[2] = &fl3;
  values[3] = &fl4;

  /* Initialize the cif */
  CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4,
		     &ffi_type_float, args) == FFI_OK);
  fl1 = 127.0;
  fl2 = 128.0;
  fl3 = 255.1;
  fl4 = 512.7;

  ffi_call(&cif, FFI_FN(return_fl), &rfl, values);
  printf ("%f vs %f\n", rfl, return_fl(fl1, fl2, fl3, fl4));

  sum = fl1 + fl2 + fl3 + fl4;
  CHECK(rfl == sum);
  exit(0);
}

Version data entries

5,923 entries across 5,900 versions & 69 rubygems

Version Path
ory-client-1.13.1 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
ory-client-1.13.0 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
mux_ruby-3.17.0 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
affixapi-1.1.88 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
affixapi-1.1.87 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
affixapi-1.1.86 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
affixapi-1.1.85 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
affixapi-1.1.84 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
ffi-1.17.0 ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
cybrid_api_id_ruby-0.117.27 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
cybrid_api_organization_ruby-0.117.27 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
cybrid_api_bank_ruby-0.117.27 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
cybrid_api_id_ruby-0.117.26 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
cybrid_api_organization_ruby-0.117.26 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
cybrid_api_bank_ruby-0.117.26 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
cybrid_api_bank_ruby-0.117.25 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
cybrid_api_id_ruby-0.117.25 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
cybrid_api_organization_ruby-0.117.25 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
cybrid_api_organization_ruby-0.117.24 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c
cybrid_api_id_ruby-0.117.24 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c