public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/42647]  New: Missed initialization/dealloc of allocatable scalar DT with allocatable component
@ 2010-01-07 16:04 burnus at gcc dot gnu dot org
  2010-01-09 17:35 ` [Bug fortran/42647] " burnus at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 15+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-01-07 16:04 UTC (permalink / raw)
  To: gcc-bugs

Follow up to PR 41872.

The following program shows at run time:
  Fortran runtime error: Attempting to allocate already allocated array 'a'


  type t
    ! Any scalar/array allocatable component will do for the wrong-code
    integer, allocatable :: d
  end type
  type(t), allocatable :: a
  allocate(a)
end

As:
  struct t * a;
  {
     if (a == NULL) { ...} else { _gfortran_runtime_error_at ... }

There is missing a:
  a = NULL;

 * * *

Another issue: Assume that "a" is not allocated. Then the following will crash:

  if (a->d != 0B)
    {
      __builtin_free ((void *) a->d);
    }
  a->d = 0B;

 * * *

Third issue: There is no automatic deallocation of "a", only of its component
"a%d".


-- 
           Summary: Missed initialization/dealloc of allocatable scalar DT
                    with allocatable component
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
OtherBugsDependingO 42361
             nThis:


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


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

end of thread, other threads:[~2010-10-26 17:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-42647-4@http.gcc.gnu.org/bugzilla/>
2010-10-13 13:22 ` [Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component burnus at gcc dot gnu.org
2010-10-25 16:25 ` [Bug fortran/42647] [F03] " janus at gcc dot gnu.org
2010-10-26 17:39 ` janus at gcc dot gnu.org
2010-10-26 17:52 ` janus at gcc dot gnu.org
2010-01-07 16:04 [Bug fortran/42647] New: " burnus at gcc dot gnu dot org
2010-01-09 17:35 ` [Bug fortran/42647] " burnus at gcc dot gnu dot org
2010-01-09 21:29 ` burnus at gcc dot gnu dot org
2010-01-09 21:30 ` burnus at gcc dot gnu dot org
2010-01-10 15:37 ` dominiq at lps dot ens dot fr
2010-01-27 10:48 ` burnus at gcc dot gnu dot org
2010-05-15 21:25 ` dominiq at lps dot ens dot fr
2010-05-15 22:03 ` janus at gcc dot gnu dot org
2010-05-15 22:17 ` janus at gcc dot gnu dot org
2010-05-15 22:29 ` janus at gcc dot gnu dot org
2010-05-16 14:40 ` dominiq at lps dot ens dot fr
2010-09-02 14:49 ` dominiq at lps dot ens dot fr

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