Commit bb9e683e by Tobias Burnus Committed by Tobias Burnus

re PR fortran/20888 (dereferencing NULL still accepted)

2007-07-03  Tobias Burnus  <burnus@net-b.de>

	PR fortran/20888
	* resolve.c (resolve_operator): Check for NULL as operand.

2007-07-03  Tobias Burnus  <burnus@net-b.de>

	PR fortran/20888
	* gfortran.dg/null_2.f90: New.

From-SVN: r126247
parent 30b74385
2007-07-03 Tobias Burnus <burnus@net-b.de>
PR fortran/20888
* resolve.c (resolve_operator): Check for NULL as operand.
2007-07-02 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (Fortran 2003): Add ISO Bind C.
......
......@@ -2583,6 +2583,13 @@ resolve_operator (gfc_expr *e)
op2 = e->value.op.op2;
dual_locus_error = false;
if ((op1 && op1->expr_type == EXPR_NULL)
|| (op2 && op2->expr_type == EXPR_NULL))
{
sprintf (msg, _("Invalid context for NULL() pointer at %%L"));
goto bad_op;
}
switch (e->value.op.operator)
{
case INTRINSIC_UPLUS:
......
2007-07-03 Tobias Burnus <burnus@net-b.de>
PR fortran/20888
* gfortran.dg/null_2.f90: New.
2007-07-03 Uros Bizjak <ubizjak@gmail.com>
Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
! { dg-do compile }
!
! NULL(...) pointer is not allowed as operand
! PR fortran/20888
!
! Contributed by Joost VandeVondele
!
PROGRAM main
IMPLICIT NONE
REAL, POINTER :: TEST
NULLIFY(TEST)
TEST => -NULL(TEST) ! { dg-error "Invalid context for NULL" }
IF (TEST .EQ. NULL(TEST)) TEST=>NULL() ! { dg-error "Invalid context for NULL" }
IF (NULL(TEST) .EQ. TEST) TEST=>NULL() ! { dg-error "Invalid context for NULL" }
END PROGRAM main
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