gcc-patches@gcc.gnu.org
[Top] [All Lists]

[Patch, fortran] PR27584 - ICE on invalid "associate(x,(y))"

Subject: [Patch, fortran] PR27584 - ICE on invalid "associate(x,(y))"
From: Paul Thomas
Date: Tue, 16 May 2006 06:58:52 +0200
:ADDPATCH fortran:

At the risk of getting my head bitten off again, I want to violate another ICE!

This time, I think that it really is warranted; not only is the argument of gcc_assert NULL butI can write fortran that produces every other expression type, thereby triggering the ICE. This is an ICE that literally asserts nothing, acts as a backstop to bad code and can be better replaced by a proper error.

This patch needs no explanation that is not amply covered by the ChangeLog.

Regtested on FC5/Athlon 1700.  OK for trunk and 1 week later 4.1?

Paul

2006-05-16  Paul Thomas  <pault@xxxxxxxxxxx>

   PR fortran/27584
   * check.c (gfc_check_associated): Replace NULL assert with an
   error message, since it is possible to generate bad code that
   has us fall through to here..

2006-05-16  Paul Thomas  <pault@xxxxxxxxxxx>

   PR fortran/27584
   * gfortran.dg/associated_target_1.f90: New test.



Index: gcc/fortran/check.c
===================================================================
*** gcc/fortran/check.c (revision 113735)
--- gcc/fortran/check.c (working copy)
*************** gfc_check_associated (gfc_expr * pointer
*** 532,538 ****
    else if (target->expr_type == EXPR_FUNCTION)
      attr = target->symtree->n.sym->attr;
    else
!     gcc_assert (0); /* Target must be a variable or a function.  */
  
    if (!attr.pointer && !attr.target)
      {
--- 532,543 ----
    else if (target->expr_type == EXPR_FUNCTION)
      attr = target->symtree->n.sym->attr;
    else
!     {
!       gfc_error ("'%s' argument of '%s' intrinsic at %L must be a pointer "
!                "or target VARIABLE or FUNCTION", gfc_current_intrinsic_arg[1],
!                gfc_current_intrinsic, &target->where);
!       return FAILURE;
!     }
  
    if (!attr.pointer && !attr.target)
      {
2006-05-15  Paul Thomas  <pault@xxxxxxxxxxx>

        PR fortran/27584
        * check.c (gfc_check_associated): Replace NULL assert with an
        error message, since it is possible to generate bad code that
        has us fall through to here..

2006-05-15  Paul Thomas  <pault@xxxxxxxxxxx>

        PR fortran/27584
        * gfortran.dg/associated_target_1.f90: New test.

<Prev in Thread] Current Thread [Next in Thread>