public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/17678] New: USE statement incorrectly initializes allocatable array
@ 2004-09-26 13:58 lei at il dot ibm dot com
  2004-09-26 14:15 ` [Bug fortran/17678] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: lei at il dot ibm dot com @ 2004-09-26 13:58 UTC (permalink / raw)
  To: gcc-bugs

% gfortran --static test.f90
% a.out
 oops
Abort (core dumped)

% cat test.f90

module foo
  integer, dimension(:), allocatable :: bar
end module

program main
  use foo
  allocate (bar(100))
  call init
end program main

subroutine init
  use foo
  if (.not.allocated(bar)) then
     print *, 'oops'
     call abort
  endif
end subroutine init

=====================================

And here is the dump-tree-original, which clearly shows the problem:

init ()
{
  extern struct array1_int4 bar;

  bar.data = 0B;           <<<<<<<<<<<<<<<<< ALLOCATION IS LOST HERE
  if (bar.data != 0B == 0)
    {
      _gfortran_filename = "test.f90";
      _gfortran_line = 14;
      _gfortran_ioparm.unit = 6;
      _gfortran_ioparm.list_format = 1;
      _gfortran_st_write ();
      _gfortran_transfer_character ("oops", 4);
      _gfortran_st_write_done ();
      _gfortran_abort ();
    }

-- 
           Summary: USE statement incorrectly initializes allocatable array
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lei at il dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2004-10-07  1:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-26 13:58 [Bug fortran/17678] New: USE statement incorrectly initializes allocatable array lei at il dot ibm dot com
2004-09-26 14:15 ` [Bug fortran/17678] " pinskia at gcc dot gnu dot org
2004-09-27 19:25 ` tobi at gcc dot gnu dot org
2004-09-28 16:01 ` tobi at gcc dot gnu dot org
2004-10-07  0:43 ` cvs-commit at gcc dot gnu dot org
2004-10-07  1:02 ` pinskia 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).