This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/15754] New: [gfortran] Accepts assignment of the form POINT = NULL()
- From: "tobi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 May 2004 22:29:14 -0000
- Subject: [Bug fortran/15754] New: [gfortran] Accepts assignment of the form POINT = NULL()
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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