aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/lto/bind_c-2b_1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/lto/bind_c-2b_1.c')
-rw-r--r--gcc/testsuite/gfortran.dg/lto/bind_c-2b_1.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/lto/bind_c-2b_1.c b/gcc/testsuite/gfortran.dg/lto/bind_c-2b_1.c
new file mode 100644
index 00000000000..d00508123b9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/bind_c-2b_1.c
@@ -0,0 +1,36 @@
+#include <stdlib.h>
+/* interopse with myftype_1 */
+typedef struct {
+ signed char chr;
+ signed char chr2;
+} 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 *cchr;
+ asm("":"=r"(cchr):"0"(&myVar));
+ cchr->chr = 1;
+ cchr->chr2 = 2;
+
+ types_test();
+
+ if(cchr->chr != 2)
+ abort();
+ if(cchr->chr2 != 2)
+ abort();
+ myVar.chr2 = 3;
+ types_test();
+
+ if(myVar.chr != 3)
+ abort();
+ if(myVar.chr2 != 3)
+ abort();
+ return 0;
+}
+