view gcc/testsuite/gfortran.dg/lto/bind_c-1_1.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
line wrap: on
line source

#include <stdlib.h>
/* interopse with myftype_1 */
typedef struct {
   float *ptr;
   int *ptr2;
} myctype_t;


extern void abort(void);
void types_test(void);
/* declared in the fortran module */
extern myctype_t myVar;

int main(int argc, char **argv)
{
   myctype_t *cptr;
   asm("":"=r"(cptr):"0"(&myVar));
   cptr->ptr = (float *)(size_t) (void *)1;
   cptr->ptr2 = (int *)(size_t) (void *)2;

   types_test();

   if(cptr->ptr != (float *)(size_t) (void *)2)
      abort();
   if(cptr->ptr2 != (int *)(size_t) (void *)2)
      abort();
   myVar.ptr2 = (int *)(size_t) (void *)3;
   types_test();

   if(myVar.ptr != (float *)(size_t) (void *)3)
      abort();
   if(myVar.ptr2 != (int *)(size_t) (void *)3)
      abort();
   return 0;
}