[Fortran] PR 46325 make testcase valid

Submitted by Tobias Burnus on Nov. 11, 2010, 10:39 p.m.


Message ID 4CDC70BD.3050502@net-b.de
State New
Headers show

Commit Message

Tobias Burnus Nov. 11, 2010, 10:39 p.m.
I intent to commit the following patch as obvious. For the background 
see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46325

Short version: The test case is invalid as the effective argument to 
"pfoo" does not have the target attribute. (It is an array constructor.) 
Thus, the pointer association status of the return value of "pfoo" is 
undefined. Solution: Make sure the value remains defined.

The issue was analysed by Jakub. Thanks!


2010-11-11  Jakub Jelinek <jakub@redhat.com>
     Tobias Burnus <burnus@net-b.de>

     PR fortran/46325
     * gfortran.dg/char_initialiser_actual.f90: Make test case valid.

Patch hide | download patch | download mbox

diff --git a/gcc/testsuite/gfortran.dg/char_initialiser_actual.f90 
index d123aca..dbd7890 100644
--- a/gcc/testsuite/gfortran.dg/char_initialiser_actual.f90
+++ b/gcc/testsuite/gfortran.dg/char_initialiser_actual.f90
@@ -24,6 +24,7 @@  contains
    function pfoo(ch2)
       character*5, dimension(:), target  :: ch2
       character*5, dimension(:), pointer :: pfoo
-     pfoo => ch2
+     allocate(pfoo(size(ch2)))
+     pfoo = ch2
    end function pfoo
  end program