public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51435] New: Bad association status after null() of derived type component
@ 2011-12-06  9:29 darmar.xxl at gmail dot com
  2011-12-06 10:08 ` [Bug fortran/51435] [4.6/4.7 Regression] " burnus at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: darmar.xxl at gmail dot com @ 2011-12-06  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51435
           Summary: Bad association status after null() of derived type
                    component
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: darmar.xxl@gmail.com


Created attachment 26002
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26002
test code

Here is the code:
!---------------
module arr_m
    type arr_t
        real(8), dimension(:), allocatable :: rsk
        ! if allocatable changed to pointer, all is OK
    end type
end module arr_m
!*********************
module list_m
    use arr_m
    implicit none

    type my_list
        type(arr_t), pointer :: head => null()
        !!!integer, pointer     :: tail => null() !if this is uncommented, all
is OK.
    end type my_list
end module list_m
!***********************
module worker_mod
    use list_m
    implicit none

    type data_all_t
        type(my_list) :: my_data
    end type data_all_t
contains
    subroutine do_job()
        type(data_all_t) :: dum

        if (associated(dum%my_data%head)) then
            print *, 'do_job my_data%head is associated' 
!
! gfortran goes here.
! WRONG. head was nullified.
!
        else
            print *, 'do_job my_data%head is NOT associated' ! OK
        end if

    end subroutine

end module
!***************
program hello
    use worker_mod
    implicit none

    call do_job()

end program
!***************


gfortran reports that dum%my_data%head is associated in the sub "do_job", while
"head" component was nullified using null() in the variable declaration line.

I tested this with gfortran 4.6 and 4.7 on Linux and Windows (produces wrong
results). Version 4.5 outputs correct result. (ifort is OK).


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-12-20 17:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-06  9:29 [Bug fortran/51435] New: Bad association status after null() of derived type component darmar.xxl at gmail dot com
2011-12-06 10:08 ` [Bug fortran/51435] [4.6/4.7 Regression] " burnus at gcc dot gnu.org
2011-12-06 10:34 ` burnus at gcc dot gnu.org
2011-12-06 13:08 ` jakub at gcc dot gnu.org
2011-12-06 14:01 ` dominiq at lps dot ens.fr
2011-12-06 18:10 ` burnus at gcc dot gnu.org
2011-12-06 19:27 ` burnus at gcc dot gnu.org
2011-12-06 19:30 ` burnus at gcc dot gnu.org
2011-12-20 18:06 ` burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).