This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/15754] New: [gfortran] Accepts assignment of the form POINT = NULL()


gfortran accepts invalid code like
 INTEGER, POINTER :: P
 P = NULL() ! wrong
 P => NULL()
 END
(notice the simple assignment '=' in lieu of an array assignment '=>'). During
code generation the return value of NULL() is then treated as the integer zero,
instead of the NULL pointer.

The assembly generated for this example:
MAIN__:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $4, %esp
        movl    -4(%ebp), %eax
        movl    $0, (%eax)   ; B = NULL()
        movl    $0, -4(%ebp) ; B => NULL()
        leave
        ret

(I spotted this when investigating PR12841, and both failures are related,
though not dependent on one another)

-- 
           Summary: [gfortran] Accepts assignment of the form POINT = NULL()
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tobi at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]