public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/25031]  New: Allocatable array can be reallocated.
@ 2005-11-25  9:00 iguchi at coral dot t dot u-tokyo dot ac dot jp
  2005-11-25 15:09 ` [Bug fortran/25031] " eedelman at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: iguchi at coral dot t dot u-tokyo dot ac dot jp @ 2005-11-25  9:00 UTC (permalink / raw)
  To: gcc-bugs

In the following program, the run-time error should occur.
at the second allocation.

But I can successfully executed the program.
And at the second allocation, memory leak is also occur.

I think this is wrong behavior.

program alloc_test
  implicit none
  integer, allocatable :: a(:)

  allocate(a(4))
  allocate(a(4))
end program


-- 
           Summary: Allocatable array can be reallocated.
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: iguchi at coral dot t dot u-tokyo dot ac dot jp


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


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

* [Bug fortran/25031] Allocatable array can be reallocated.
  2005-11-25  9:00 [Bug fortran/25031] New: Allocatable array can be reallocated iguchi at coral dot t dot u-tokyo dot ac dot jp
@ 2005-11-25 15:09 ` eedelman at gcc dot gnu dot org
  2006-01-28 18:49 ` tkoenig at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: eedelman at gcc dot gnu dot org @ 2005-11-25 15:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from eedelman at gcc dot gnu dot org  2005-11-25 15:09 -------
Confirmed.


-- 

eedelman at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eedelman at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-11-25 15:09:21
               date|                            |


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


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

* [Bug fortran/25031] Allocatable array can be reallocated.
  2005-11-25  9:00 [Bug fortran/25031] New: Allocatable array can be reallocated iguchi at coral dot t dot u-tokyo dot ac dot jp
  2005-11-25 15:09 ` [Bug fortran/25031] " eedelman at gcc dot gnu dot org
@ 2006-01-28 18:49 ` tkoenig at gcc dot gnu dot org
  2006-03-03 16:18 ` tkoenig at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-01-28 18:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tkoenig at gcc dot gnu dot org  2006-01-28 18:49 -------
This one is a bit tricky, because the code would
be legal (if memory-leaking) for if a were a pointer.
Also, using a stat variable is supposed to catch this.

Seems like we need a new function for allocating allocatable
arrays, which checks for allocation status and errors out if
the array is already allocated.


-- 


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


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

* [Bug fortran/25031] Allocatable array can be reallocated.
  2005-11-25  9:00 [Bug fortran/25031] New: Allocatable array can be reallocated iguchi at coral dot t dot u-tokyo dot ac dot jp
  2005-11-25 15:09 ` [Bug fortran/25031] " eedelman at gcc dot gnu dot org
  2006-01-28 18:49 ` tkoenig at gcc dot gnu dot org
@ 2006-03-03 16:18 ` tkoenig at gcc dot gnu dot org
  2006-03-23 18:36 ` tkoenig at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-03-03 16:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tkoenig at gcc dot gnu dot org  2006-03-03 16:18 -------
Subject: Bug 25031

Author: tkoenig
Date: Fri Mar  3 16:18:46 2006
New Revision: 111677

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111677
Log:
2006-03-03  Thomas Koenig  <Thomas.Koenig@online.de>

        PR fortran/25031
        * trans-array.h:  Adjust gfc_array_allocate prototype.
        * trans-array.c (gfc_array_allocate):  Change type of
        gfc_array_allocatate to bool.  Function returns true if
        it operates on an array.  Change second argument to gfc_expr.
        Find last reference in chain.
        If the function operates on an allocatable array, emit call to
        allocate_array() or allocate64_array().
        * trans-stmt.c (gfc_trans_allocate):  Code to follow to last
        reference has been moved to gfc_array_allocate.
        * trans.h:  Add declaration for gfor_fndecl_allocate_array and
        gfor_fndecl_allocate64_array.
        (gfc_build_builtin_function_decls):  Add gfor_fndecl_allocate_array
        and gfor_fndecl_allocate64_array.

2006-03-03  Thomas Koenig  <Thomas.Koenig@online.de>

        PR fortran/25031
        * runtime/memory.c:  Adjust copyright years.
        (allocate_array):  New function.
        (allocate64_array):  New function.
        * libgfortran.h (error_codes):  Add ERROR_ALLOCATION.

2006-03-03  Thomas Koenig  <Thomas.Koenig@online.de>

        PR fortran/25031
        * multiple_allocation_1.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/multiple_allocation_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-array.h
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/fortran/trans.h
    trunk/gcc/testsuite/ChangeLog
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/libgfortran.h
    trunk/libgfortran/runtime/memory.c


-- 


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


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

* [Bug fortran/25031] Allocatable array can be reallocated.
  2005-11-25  9:00 [Bug fortran/25031] New: Allocatable array can be reallocated iguchi at coral dot t dot u-tokyo dot ac dot jp
                   ` (2 preceding siblings ...)
  2006-03-03 16:18 ` tkoenig at gcc dot gnu dot org
@ 2006-03-23 18:36 ` tkoenig at gcc dot gnu dot org
  2006-03-30 16:30 ` tkoenig at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-03-23 18:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from tkoenig at gcc dot gnu dot org  2006-03-23 18:36 -------
There is a problem with the current solution on trunk.

When we do

    allocate (a(10))
    allocate (a(20),stat=i)

the size information is changed, but the size of the array is not.


-- 


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


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

* [Bug fortran/25031] Allocatable array can be reallocated.
  2005-11-25  9:00 [Bug fortran/25031] New: Allocatable array can be reallocated iguchi at coral dot t dot u-tokyo dot ac dot jp
                   ` (3 preceding siblings ...)
  2006-03-23 18:36 ` tkoenig at gcc dot gnu dot org
@ 2006-03-30 16:30 ` tkoenig at gcc dot gnu dot org
  2006-04-08 17:05 ` [Bug fortran/25031] [4.1 only] " tkoenig at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-03-30 16:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from tkoenig at gcc dot gnu dot org  2006-03-30 16:30 -------
Subject: Bug 25031

Author: tkoenig
Date: Thu Mar 30 16:30:26 2006
New Revision: 112539

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112539
Log:
2006-03-30  Thomas Koenig  <Thomas.Koenig@online.de>

        PR fortran/25031
        * runtime/memory.c (allocate_array):  If stat is present and
        the variable is already allocated, free the variable, do
        the allocation and set stat.
        (allocate_array_64):  Likewise.  Whitespace fix.

2006-03-30  Thomas Koenig  <Thomas.Koenig@online.de>

        PR fortran/25031
        * gfortran.dg/multiple_allocation_1.f90:  Check that the
        size has changed after a re-allocation with stat.


Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/multiple_allocation_1.f90
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/runtime/memory.c


-- 


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


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

* [Bug fortran/25031] [4.1 only] Allocatable array can be reallocated.
  2005-11-25  9:00 [Bug fortran/25031] New: Allocatable array can be reallocated iguchi at coral dot t dot u-tokyo dot ac dot jp
                   ` (4 preceding siblings ...)
  2006-03-30 16:30 ` tkoenig at gcc dot gnu dot org
@ 2006-04-08 17:05 ` tkoenig at gcc dot gnu dot org
  2006-04-08 17:06 ` tkoenig at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-04-08 17:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from tkoenig at gcc dot gnu dot org  2006-04-08 17:05 -------
Subject: Bug 25031

Author: tkoenig
Date: Sat Apr  8 17:05:52 2006
New Revision: 112783

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112783
Log:
2006-04-08  Thomas Koenig  <Thomas.Koenig@online.de>

        PR fortran/25031
        Backport from mainline
        * trans-array.h:  Adjust gfc_array_allocate prototype.
        * trans-array.c (gfc_array_allocate):  Change type of
        gfc_array_allocatate to bool.  Function returns true if
        it operates on an array.  Change second argument to gfc_expr.
        Find last reference in chain.
        If the function operates on an allocatable array, emit call to
        allocate_array() or allocate64_array().
        * trans-stmt.c (gfc_trans_allocate):  Code to follow to last
        reference has been moved to gfc_array_allocate.
        * trans.h:  Add declaration for gfor_fndecl_allocate_array and
        gfor_fndecl_allocate64_array.
        (gfc_build_builtin_function_decls):  Add gfor_fndecl_allocate_array
        and gfor_fndecl_allocate64_array.

2006-04-08  Thomas Koenig  <Thomas.Koenig@online.de>

        PR fortran/25031
        Backport from mainline
        * runtime/memory.c:  Adjust copyright years.
        (allocate_array):  New function.
        (allocate64_array):  New function.
        * libgfortran.h (error_codes):  Add ERROR_ALLOCATION.

2006-04-08  Thomas Koenig  <Thomas.Koenig@online.de>

        PR fortran/25031
        * gfortran.dg/multiple_allocation_1.f90:  New test.


Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/multiple_allocation_1.f90
Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/trans-array.c
    branches/gcc-4_1-branch/gcc/fortran/trans-array.h
    branches/gcc-4_1-branch/gcc/fortran/trans-decl.c
    branches/gcc-4_1-branch/gcc/fortran/trans-stmt.c
    branches/gcc-4_1-branch/gcc/fortran/trans.h
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/libgfortran/ChangeLog


-- 


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


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

* [Bug fortran/25031] [4.1 only] Allocatable array can be reallocated.
  2005-11-25  9:00 [Bug fortran/25031] New: Allocatable array can be reallocated iguchi at coral dot t dot u-tokyo dot ac dot jp
                   ` (5 preceding siblings ...)
  2006-04-08 17:05 ` [Bug fortran/25031] [4.1 only] " tkoenig at gcc dot gnu dot org
@ 2006-04-08 17:06 ` tkoenig at gcc dot gnu dot org
  2006-04-09  9:00 ` tkoenig at gcc dot gnu dot org
  2006-04-12  1:23 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-04-08 17:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from tkoenig at gcc dot gnu dot org  2006-04-08 17:06 -------
Fixed on 4.1.  Closing.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug fortran/25031] [4.1 only] Allocatable array can be reallocated.
  2005-11-25  9:00 [Bug fortran/25031] New: Allocatable array can be reallocated iguchi at coral dot t dot u-tokyo dot ac dot jp
                   ` (6 preceding siblings ...)
  2006-04-08 17:06 ` tkoenig at gcc dot gnu dot org
@ 2006-04-09  9:00 ` tkoenig at gcc dot gnu dot org
  2006-04-12  1:23 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-04-09  9:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from tkoenig at gcc dot gnu dot org  2006-04-09 09:00 -------
Subject: Bug 25031

Author: tkoenig
Date: Sun Apr  9 09:00:49 2006
New Revision: 112802

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112802
Log:
2006-04-09  Thomas Koenig  <Thomas.Koenig@online.de>

        PR fortran/25031
        * runtime/memory.c:  Really commit change.
        * libgfortran.h:  Likewise.


Modified:
    branches/gcc-4_1-branch/libgfortran/ChangeLog
    branches/gcc-4_1-branch/libgfortran/libgfortran.h
    branches/gcc-4_1-branch/libgfortran/runtime/memory.c


-- 


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


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

* [Bug fortran/25031] [4.1 only] Allocatable array can be reallocated.
  2005-11-25  9:00 [Bug fortran/25031] New: Allocatable array can be reallocated iguchi at coral dot t dot u-tokyo dot ac dot jp
                   ` (7 preceding siblings ...)
  2006-04-09  9:00 ` tkoenig at gcc dot gnu dot org
@ 2006-04-12  1:23 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-12  1:23 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.1


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


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

end of thread, other threads:[~2006-04-12  1:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-25  9:00 [Bug fortran/25031] New: Allocatable array can be reallocated iguchi at coral dot t dot u-tokyo dot ac dot jp
2005-11-25 15:09 ` [Bug fortran/25031] " eedelman at gcc dot gnu dot org
2006-01-28 18:49 ` tkoenig at gcc dot gnu dot org
2006-03-03 16:18 ` tkoenig at gcc dot gnu dot org
2006-03-23 18:36 ` tkoenig at gcc dot gnu dot org
2006-03-30 16:30 ` tkoenig at gcc dot gnu dot org
2006-04-08 17:05 ` [Bug fortran/25031] [4.1 only] " tkoenig at gcc dot gnu dot org
2006-04-08 17:06 ` tkoenig at gcc dot gnu dot org
2006-04-09  9:00 ` tkoenig at gcc dot gnu dot org
2006-04-12  1:23 ` 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).