public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51207] New: [OOP] Mark __def_init_... as FL_PARAMETER
@ 2011-11-18  9:51 burnus at gcc dot gnu.org
  2011-11-18  9:57 ` [Bug fortran/51207] " burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-18  9:51 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51207
           Summary: [OOP] Mark __def_init_... as FL_PARAMETER
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


module m
type t
  integer :: i = 4
end type t
end module m


use m
class(t), allocatable :: x, y

allocate(t :: y)
allocate(x, mold=x)

if (x%i /= 4 ) call bfjkhskllf()
end


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

* [Bug fortran/51207] [OOP] Mark __def_init_... as FL_PARAMETER
  2011-11-18  9:51 [Bug fortran/51207] New: [OOP] Mark __def_init_... as FL_PARAMETER burnus at gcc dot gnu.org
@ 2011-11-18  9:57 ` burnus at gcc dot gnu.org
  2011-11-18 10:56 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-18  9:57 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |janus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-18 09:50:39 UTC ---
Hit enter too early. The problem is that the __def_init_... is not marked as
FL_PARAMETER and hence not as TREE_READONLY.

However, even if one manually sets attr.flavor == FL_PARAMETER, the call does
not seem to get optimized away. I assume that's because one has:

  __builtin_memcpy (D.1947_18, &__def_init_m_T, D.1957_16);

which makes the analysis more difficult. Nevertheless, the default
initialization should be marked as TREE_READONLY.


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

* [Bug fortran/51207] [OOP] Mark __def_init_... as FL_PARAMETER
  2011-11-18  9:51 [Bug fortran/51207] New: [OOP] Mark __def_init_... as FL_PARAMETER burnus at gcc dot gnu.org
  2011-11-18  9:57 ` [Bug fortran/51207] " burnus at gcc dot gnu.org
@ 2011-11-18 10:56 ` burnus at gcc dot gnu.org
  2011-11-19  9:30 ` burnus at gcc dot gnu.org
  2011-11-19 10:19 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-18 10:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-18 10:00:43 UTC ---
  allocate(t :: y)
  allocate(x, mold=x)

The last line should be: "x, mold=y". (Cf. PR 51208.)


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

* [Bug fortran/51207] [OOP] Mark __def_init_... as FL_PARAMETER
  2011-11-18  9:51 [Bug fortran/51207] New: [OOP] Mark __def_init_... as FL_PARAMETER burnus at gcc dot gnu.org
  2011-11-18  9:57 ` [Bug fortran/51207] " burnus at gcc dot gnu.org
  2011-11-18 10:56 ` burnus at gcc dot gnu.org
@ 2011-11-19  9:30 ` burnus at gcc dot gnu.org
  2011-11-19 10:19 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-19  9:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-19 09:26:38 UTC ---
Author: burnus
Date: Sat Nov 19 09:26:33 2011
New Revision: 181505

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181505
Log:
2011-11-19  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51207
        * class.c (gfc_find_derived_vtab): Mark __def_init as PARAMETER
        and hence as TREE_READONLY; add subroutine attribute to
        __copy_ procedure.

        PR fortran/50640
        * trans.h (GFC_DECL_PUSH_TOPLEVEL): New DECL_LANG_FLAG_7.
        * trans-decl.c (gfc_get_symbol_decl): Mark __def_init and vtab
        as GFC_DECL_PUSH_TOPLEVEL.
        (gfc_generate_function_code): If GFC_DECL_PUSH_TOPLEVEL, push it there.
        (build_function_decl): Push __copy_ procedure to the toplevel.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/class.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans.h


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

* [Bug fortran/51207] [OOP] Mark __def_init_... as FL_PARAMETER
  2011-11-18  9:51 [Bug fortran/51207] New: [OOP] Mark __def_init_... as FL_PARAMETER burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-11-19  9:30 ` burnus at gcc dot gnu.org
@ 2011-11-19 10:19 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-19 10:19 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-19 09:30:05 UTC ---
FIXED on the 4.7 trunk.


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

end of thread, other threads:[~2011-11-19  9:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-18  9:51 [Bug fortran/51207] New: [OOP] Mark __def_init_... as FL_PARAMETER burnus at gcc dot gnu.org
2011-11-18  9:57 ` [Bug fortran/51207] " burnus at gcc dot gnu.org
2011-11-18 10:56 ` burnus at gcc dot gnu.org
2011-11-19  9:30 ` burnus at gcc dot gnu.org
2011-11-19 10:19 ` burnus at gcc dot gnu.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).