[Bug fortran/40605] New: -fcheck=pointer: Problems with OPTIONAL

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jul 1 12:44:00 GMT 2009


-fcheck=pointer gives a segfault for a not present actual argument. Fix:

+++ trans-expr.c        (working copy)
@@ -2778 +2778 @@ gfc_conv_procedure_call (gfc_se * se, gf
-      if (gfc_option.rtcheck & GFC_RTCHECK_POINTER)
+      if (gfc_option.rtcheck & GFC_RTCHECK_POINTER && e != NULL)

Test case:

      SUBROUTINE rw_inp(scpos)
      IMPLICIT NONE
      REAL scpos

      interface
        FUNCTION evaluateFirst(s,n)result(number)
          IMPLICIT NONE
          CHARACTER(len =*), INTENT(inout) :: s
          INTEGER,OPTIONAL                 :: n
          REAL                             :: number
        end function
      end interface

      CHARACTER(len=100) :: line
      scpos = evaluatefirst(line)
      END SUBROUTINE rw_inp


-- 
           Summary: -fcheck=pointer: Problems with OPTIONAL
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40605



More information about the Gcc-bugs mailing list