Patchwork [Fortran] PR 46325 make testcase valid

login
register
mail settings
Submitter Tobias Burnus
Date Nov. 11, 2010, 10:39 p.m.
Message ID <4CDC70BD.3050502@net-b.de>
Download mbox | patch
Permalink /patch/70884/
State New
Headers show

Comments

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!

Tobias

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

diff --git a/gcc/testsuite/gfortran.dg/char_initialiser_actual.f90 
b/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