Commit 85ff2938 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/50718 (ICE (fold_convert) with -fcheck=pointer)

2011-10-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50718
        * trans-expr.c (gfc_conv_procedure_call): Fix -fcheck=pointer
        for dummy arguments with VALUE attribute.

2011-10-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50718
        * gfortran.dg/pointer_check_11.f90: New.
        * gfortran.dg/pointer_check_12.f90: New.

From-SVN: r179988
parent 8c353205
2011-10-14 Tobias Burnus <burnus@net-b.de>
PR fortran/50718
* trans-expr.c (gfc_conv_procedure_call): Fix -fcheck=pointer
for dummy arguments with VALUE attribute.
2011-10-11 Tobias Burnus <burnus@net-b.de>
Janus Weil <janus@gcc.gnu.org>
......
......@@ -3357,10 +3357,16 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
else
goto end_pointer_check;
tmp = parmse.expr;
/* If the argument is passed by value, we need to strip the
INDIRECT_REF. */
if (!POINTER_TYPE_P (TREE_TYPE (parmse.expr)))
tmp = gfc_build_addr_expr (NULL_TREE, tmp);
cond = fold_build2_loc (input_location, EQ_EXPR,
boolean_type_node, parmse.expr,
fold_convert (TREE_TYPE (parmse.expr),
boolean_type_node, tmp,
fold_convert (TREE_TYPE (tmp),
null_pointer_node));
}
......
2011-10-14 Tobias Burnus <burnus@net-b.de>
PR fortran/50718
* gfortran.dg/pointer_check_11.f90: New.
* gfortran.dg/pointer_check_12.f90: New.
2011-10-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/38174
......
! { dg-do run }
! { dg-options "-fcheck=all" }
!
! { dg-shouldfail "Pointer check" }
! { dg-output "Fortran runtime error: Pointer actual argument 'y' is not associated" }
!
!
! PR fortran/50718
!
! Was failing (ICE) with -fcheck=pointer if the dummy had the value attribute.
type t
integer :: p
end type t
type(t), pointer :: y => null()
call sub(y) ! Invalid: Nonassociated pointer
contains
subroutine sub (x)
type(t), value :: x
end subroutine
end
! { dg-do run }
! { dg-options "-fcheck=all" }
!
! { dg-shouldfail "Pointer check" }
! { dg-output "Fortran runtime error: Pointer actual argument 'p' is not associated" }
!
! PR fortran/50718
!
! Was failing with -fcheck=pointer: Segfault at run time
integer, pointer :: p => null()
call sub2(%val(p)) ! Invalid: Nonassociated pointer
end
! Not quite correct dummy, but if one uses VALUE, gfortran
! complains about a missing interface - which we cannot use
! if we want to use %VAL().
subroutine sub2(p)
integer :: p
end subroutine sub2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment