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

* [Bug fortran/17678] USE statement incorrectly initializes allocatable array
  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 ` pinskia at gcc dot gnu dot org
  2004-09-27 19:25 ` tobi at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-26 14:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-26 14:15 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-09-26 14:15:22
               date|                            |


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


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

* [Bug fortran/17678] USE statement incorrectly initializes allocatable array
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-09-27 19:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2004-09-27 19:25 -------
The patch also passes the testsuite with no regressions.

-- 


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


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

* [Bug fortran/17678] USE statement incorrectly initializes allocatable array
  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
  4 siblings, 0 replies; 6+ messages in thread
From: tobi at gcc dot gnu dot org @ 2004-09-28 16:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tobi at gcc dot gnu dot org  2004-09-28 16:01 -------
This bug doesn't affect host associated variables. E.g.
program main
  integer, dimension(:), allocatable :: bar
  allocate (bar(100))
  call init
contains
subroutine init
  if (.not.allocated(bar)) then
     print *, 'oops'
     call abort
  endif
end subroutine init
end program main

works as expected

-- 


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


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

* [Bug fortran/17678] USE statement incorrectly initializes allocatable array
  2004-09-26 13:58 [Bug fortran/17678] New: USE statement incorrectly initializes allocatable array lei at il dot ibm dot com
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-10-07  0:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-10-07 00:43 -------
Subject: Bug 17678

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pbrook@gcc.gnu.org	2004-10-07 00:43:21

Modified files:
	gcc/fortran    : ChangeLog trans-array.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: use_allocated_1.f90 

Log message:
	PR fortran/17678
	* trans-array.c (gfc_trans_deferred_array): Leave use associated
	variables alone.
	testsuite/
	* gfortran.dg/use_allocated_1.f90: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.229&r2=1.230
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-array.c.diff?cvsroot=gcc&r1=1.28&r2=1.29
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4398&r2=1.4399
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/use_allocated_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug fortran/17678] USE statement incorrectly initializes allocatable array
  2004-09-26 13:58 [Bug fortran/17678] New: USE statement incorrectly initializes allocatable array lei at il dot ibm dot com
                   ` (3 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-07  1:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-07 01:02 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


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).