public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/41479]  New: wrong code, mis-initialization
@ 2009-09-26 21:12 reuter at physik dot uni-freiburg dot de
  2009-09-26 21:14 ` [Bug fortran/41479] " reuter at physik dot uni-freiburg dot de
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: reuter at physik dot uni-freiburg dot de @ 2009-09-26 21:12 UTC (permalink / raw)
  To: gcc-bugs

The example below shows that besides the fact that declared as INTENT(OUT) the
component 'n' is not initialized per default the second time. This is demanded
by the FORTRAN standard. 
Example code:
program main

 type :: container_t
    integer :: n = 0
    ! if the following line is omitted, the problem disappears
    integer, dimension(:), allocatable :: a
 end type container_t

 type(container_t) :: container

 call init (container)
 print *, "Initial state:"
 call dump (container)

 container%n = 1
 print *, "Modified state:"
 call dump (container)

 call init (container)
 print *, "Initial state again:"
 call dump (container)

contains

 subroutine init (container)
   type(container_t), intent(out) :: container
 end subroutine init

 subroutine dump (container)
   type(container_t), intent(in) :: container
   print "(A,I0,1x,L)", "   value = ", container%n
 end subroutine dump

end program main


-- 
           Summary: wrong code, mis-initialization
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reuter at physik dot uni-freiburg dot de
 GCC build triplet: i386-32bit, MAC OS X Leopard
  GCC host triplet: i386-32bit, MAC OS X Leopard
GCC target triplet: i386-32bit, MAC OS X Leopard


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


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

end of thread, other threads:[~2009-10-05  9:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-26 21:12 [Bug fortran/41479] New: wrong code, mis-initialization reuter at physik dot uni-freiburg dot de
2009-09-26 21:14 ` [Bug fortran/41479] " reuter at physik dot uni-freiburg dot de
2009-09-27  0:50 ` jvdelisle at gcc dot gnu dot org
2009-09-27  1:14 ` jvdelisle at gcc dot gnu dot org
2009-09-27 10:04 ` dominiq at lps dot ens dot fr
2009-09-27 17:03 ` [Bug fortran/41479] [4.3/4.4/4.5 Regression] intent(out) for types with default initialization jv244 at cam dot ac dot uk
2009-09-27 17:21 ` kargl at gcc dot gnu dot org
2009-09-27 18:19 ` kargl at gcc dot gnu dot org
2009-09-29 15:47 ` jakub at gcc dot gnu dot org
2009-10-02  9:54 ` burnus at gcc dot gnu dot org
2009-10-02 16:26 ` burnus at gcc dot gnu dot org
2009-10-05  9:19 ` burnus at gcc dot gnu dot org
2009-10-05  9:20 ` burnus at gcc dot gnu dot org
2009-10-05  9:20 ` burnus at gcc dot gnu dot 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).