diff options
author | Tobias Burnus <burnus@net-b.de> | 2013-04-20 13:01:55 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2013-04-20 13:01:55 +0200 |
commit | 6fbcd3099022d0bf7c11ccbba77df659aa2b4123 (patch) | |
tree | d03b115b24096023162d522b1161a70bbf75d45e | |
parent | 21ec136ace677ab9b2aceedd7d0327efa9ff2596 (diff) | |
download | gcc-6fbcd3099022d0bf7c11ccbba77df659aa2b4123.zip gcc-6fbcd3099022d0bf7c11ccbba77df659aa2b4123.tar.gz gcc-6fbcd3099022d0bf7c11ccbba77df659aa2b4123.tar.bz2 |
re PR fortran/56907 (C_LOC shall not call internal-PACK when an array argument is used)
2013-04-20 Tobias Burnus <burnus@net-b.de>
PR fortran/56907
* trans-intrinsic.c (conv_isocbinding_function): Don't pack
* array
passed to C_LOC
2013-04-20 Tobias Burnus <burnus@net-b.de>
PR fortran/56907
* gfortran.dg/c_loc_test_22.f90: New.
From-SVN: r198109
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/c_loc_test_22.f90 | 24 |
4 files changed, 41 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9323af9..3361a07 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2013-04-20 Tobias Burnus <burnus@net-b.de> + + PR fortran/56907 + * trans-intrinsic.c (conv_isocbinding_function): Don't pack array + passed to C_LOC + 2013-04-19 Thomas Koenig <tkoenig@gcc.gnu.org> Mikael Morin <mikael@gcc.gnu.org> diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 2a16059c..eca907e 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -6317,8 +6317,13 @@ conv_isocbinding_function (gfc_se *se, gfc_expr *expr) { if (arg->expr->rank == 0) gfc_conv_expr_reference (se, arg->expr); - else + else if (gfc_is_simply_contiguous (arg->expr, false)) gfc_conv_array_parameter (se, arg->expr, true, NULL, NULL, NULL); + else + { + gfc_conv_expr_descriptor (se, arg->expr); + se->expr = gfc_conv_descriptor_data_get (se->expr); + } /* TODO -- the following two lines shouldn't be necessary, but if they're removed, a bug is exposed later in the code path. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7227e5e..f8501e0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-04-20 Tobias Burnus <burnus@net-b.de> + + PR fortran/56907 + * gfortran.dg/c_loc_test_22.f90: New. + 2013-04-19 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/56847 diff --git a/gcc/testsuite/gfortran.dg/c_loc_test_22.f90 b/gcc/testsuite/gfortran.dg/c_loc_test_22.f90 new file mode 100644 index 0000000..5263060 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/c_loc_test_22.f90 @@ -0,0 +1,24 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original" } +! +! PR fortran/56907 +! +subroutine sub(xxx, yyy) + use iso_c_binding + implicit none + integer, target, contiguous :: xxx(:) + integer, target :: yyy(:) + type(c_ptr) :: ptr1, ptr2, ptr3, ptr4 + ptr1 = c_loc (xxx) + ptr2 = c_loc (xxx(5:)) + ptr3 = c_loc (yyy) + ptr4 = c_loc (yyy(5:)) +end +! { dg-final { scan-tree-dump-not " _gfortran_internal_pack" "original" } } +! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void .\\) &\\(.xxx.\[0-9\]+\\)\\\[0\\\];" 1 "original" } } +! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void .\\) &\\(.xxx.\[0-9\]+\\)\\\[D.\[0-9\]+ \\* 4\\\];" 1 "original" } } +! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void .\\) &\\(.yyy.\[0-9\]+\\)\\\[0\\\];" 1 "original" } } +! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void .\\) &\\(.yyy.\[0-9\]+\\)\\\[D.\[0-9\]+ \\* 4\\\];" 1 "original" } } + +! { dg-final { scan-tree-dump-times "D.\[0-9\]+ = parm.\[0-9\]+.data;\[^;]+ptr\[1-4\] = D.\[0-9\]+;" 4 "original" } } +! { dg-final { cleanup-tree-dump "optimized" } } |