[Bug fortran/44556] [4.5/4.6 Regression] incorrect error: Stat-variable at (1) shall not be DEALLOCATEd within the same DEALLOCATE statement

2010-06-22 Thread burnus at gcc dot gnu dot org


--- Comment #11 from burnus at gcc dot gnu dot org  2010-06-22 09:41 ---
Subject: Bug 44556

Author: burnus
Date: Tue Jun 22 09:41:21 2010
New Revision: 161156

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=161156
Log:
2010-06-22  Tobias Burnus  bur...@net-b.de

PR fortran/44556
* resolve.c (resolve_allocate_deallocate): Properly check
part-refs in stat=/errmsg= for invalid use.

2010-06-22  Tobias Burnus  bur...@net-b.de

PR fortran/44556
* gfortran.dg/allocate_alloc_opt_11.f90: New.


Added:
branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/allocate_alloc_opt_11.f90
Modified:
branches/gcc-4_5-branch/gcc/fortran/ChangeLog
branches/gcc-4_5-branch/gcc/fortran/resolve.c
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog


-- 


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



[Bug fortran/44556] [4.5/4.6 Regression] incorrect error: Stat-variable at (1) shall not be DEALLOCATEd within the same DEALLOCATE statement

2010-06-22 Thread burnus at gcc dot gnu dot org


--- Comment #12 from burnus at gcc dot gnu dot org  2010-06-22 09:42 ---
Now also FIXED on the 4.5 branch. Thanks again for the bug report.


-- 

burnus at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug fortran/44556] [4.5/4.6 Regression] incorrect error: Stat-variable at (1) shall not be DEALLOCATEd within the same DEALLOCATE statement

2010-06-18 Thread burnus at gcc dot gnu dot org


--- Comment #9 from burnus at gcc dot gnu dot org  2010-06-18 07:33 ---
Patch: http://gcc.gnu.org/ml/fortran/2010-06/msg00191.html


-- 

burnus at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |burnus at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED
   Last reconfirmed|2010-06-16 12:21:06 |2010-06-18 07:33:34
   date||
Summary|incorrect error:  Stat- |[4.5/4.6 Regression]
   |variable at (1) shall not be|incorrect error:  Stat-
   |DEALLOCATEd within the same |variable at (1) shall not be
   |DEALLOCATE statement|DEALLOCATEd within the same
   ||DEALLOCATE statement


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



[Bug fortran/44556] [4.5/4.6 Regression] incorrect error: Stat-variable at (1) shall not be DEALLOCATEd within the same DEALLOCATE statement

2010-06-18 Thread burnus at gcc dot gnu dot org


--- Comment #10 from burnus at gcc dot gnu dot org  2010-06-18 22:24 ---
Subject: Bug 44556

Author: burnus
Date: Fri Jun 18 22:23:40 2010
New Revision: 161011

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=161011
Log:
2010-06-18  Tobias Burnus  bur...@net-b.de

PR fortran/44556
* resolve.c (resolve_allocate_deallocate): Properly check
part-refs in stat=/errmsg= for invalid use.

2010-06-18  Tobias Burnus  bur...@net-b.de

PR fortran/44556
* gfortran.dg/allocate_alloc_opt_11.f90: New.


Added:
trunk/gcc/testsuite/gfortran.dg/allocate_alloc_opt_11.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug fortran/44556] [4.5/4.6 Regression] incorrect error: Stat-variable at (1) shall not be DEALLOCATEd within the same DEALLOCATE statement

2010-06-17 Thread burnus at gcc dot gnu dot org


--- Comment #4 from burnus at gcc dot gnu dot org  2010-06-17 10:25 ---
For completeness, the check was introduced for PR 38389 by the commit
http://gcc.gnu.org/ml/gcc-cvs/2009-03/msg00838.html


-- 


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



[Bug fortran/44556] [4.5/4.6 Regression] incorrect error: Stat-variable at (1) shall not be DEALLOCATEd within the same DEALLOCATE statement

2010-06-16 Thread burnus at gcc dot gnu dot org


--- Comment #1 from burnus at gcc dot gnu dot org  2010-06-16 12:21 ---
The following check is to simplistic, it does not work for structures but only
for simple object names. - with structures, it gets more complicated as also
comparing the name of the last part-ref won't work - but one needs to walk
through the whole structure references. 


Alternatively, one disables the check if (stat-symtree-n.sym-ts.type !=
BT_INTEGER) - that's maybe too simple, but it would fix this problem. (Maybe
that's _the_ solution for the 4.5 branch?)

[When using stat=foo%array(1), NAG, pgf95, and g95 do not print a
warning/error, but ifort, openf95, pathf95, sunf95, and Cray print an error.]


In resolve.c's resolve_allocate_deallocate:

  for (p = code-ext.alloc.list; p; p = p-next)
if (p-expr-symtree-n.sym-name == stat-symtree-n.sym-name)
  gfc_error (Stat-variable at %L shall not be %sd within 
 the same %s statement, stat-where, fcn, fcn);


-- 

burnus at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu dot org
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   GCC host triplet|x86_64-linux-gnu|
 GCC target triplet|x86_64-linux-gnu|
   Keywords||rejects-valid
  Known to fail||4.5.1 4.6.0
  Known to work||4.4.0
   Last reconfirmed|-00-00 00:00:00 |2010-06-16 12:21:06
   date||
Summary|incorrect error:  Stat- |[4.5/4.6 Regression]
   |variable at (1) shall not be|incorrect error:  Stat-
   |DEALLOCATEd within the same |variable at (1) shall not be
   |DEALLOCATE statement|DEALLOCATEd within the same
   ||DEALLOCATE statement
   Target Milestone|--- |4.5.1


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



[Bug fortran/44556] [4.5/4.6 Regression] incorrect error: Stat-variable at (1) shall not be DEALLOCATEd within the same DEALLOCATE statement

2010-06-16 Thread kargl at gcc dot gnu dot org


--- Comment #2 from kargl at gcc dot gnu dot org  2010-06-16 14:34 ---
(In reply to comment #1)
 The following check is to simplistic, it does not work for structures but only
 for simple object names. - with structures, it gets more complicated as also
 comparing the name of the last part-ref won't work - but one needs to walk
 through the whole structure references.

Not sure how I got added to the CC list.  Remove myself.


-- 

kargl at gcc dot gnu dot org changed:

   What|Removed |Added

 CC|kargl at gcc dot gnu dot org|


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



[Bug fortran/44556] [4.5/4.6 Regression] incorrect error: Stat-variable at (1) shall not be DEALLOCATEd within the same DEALLOCATE statement

2010-06-16 Thread sgk at troutmask dot apl dot washington dot edu


--- Comment #3 from sgk at troutmask dot apl dot washington dot edu  
2010-06-16 17:10 ---
Subject: Re:  [4.5/4.6 Regression] incorrect error:  Stat-variable at (1) shall
not be DEALLOCATEd within the same DEALLOCATE statement

On Wed, Jun 16, 2010 at 02:34:34PM -, kargl at gcc dot gnu dot org wrote:
 
 --- Comment #2 from kargl at gcc dot gnu dot org  2010-06-16 14:34 ---
 (In reply to comment #1)
  The following check is to simplistic, it does not work for structures but 
  only
  for simple object names. - with structures, it gets more complicated as also
  comparing the name of the last part-ref won't work - but one needs to walk
  through the whole structure references.
 
 Not sure how I got added to the CC list.  Remove myself.
 

BTW, this won't work either.

program oh_my

   type a
  integer, allocatable :: b(:), d(:)
  character(len=80) :: err
  integer :: src
   end type a

   integer j
   type(a) :: c

   c%err = 'ok'

   allocate(c%b(2), errmsg=c%err, stat=j)

   deallocate(c%b, errmsg=c%err, stat=j)

end program oh_my

gfortran does not walk the components of a derived type.


-- 


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