From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11735 invoked by alias); 26 Sep 2009 21:12:58 -0000 Received: (qmail 11695 invoked by uid 48); 26 Sep 2009 21:12:48 -0000 Date: Sat, 26 Sep 2009 21:12:00 -0000 Subject: [Bug fortran/41479] New: wrong code, mis-initialization X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "reuter at physik dot uni-freiburg dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg02448.txt.bz2 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