public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/41580] [OOP] SAME_TYPE_AS and EXTENDS_TYPE_OF - add compile-time simplifcation
[not found] <bug-41580-4@http.gcc.gnu.org/bugzilla/>
@ 2011-01-05 12:16 ` janus at gcc dot gnu.org
2011-01-05 17:31 ` burnus at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu.org @ 2011-01-05 12:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41580
--- Comment #4 from janus at gcc dot gnu.org 2011-01-05 12:16:33 UTC ---
(In reply to comment #2)
> For SAME_TYPE_AS and EXTENDS_TYPE_OF one should add a
> compile-time simplification to simplify.c.
> Currently, only the run-time version is implemented.
Well, currently the translation of SAME_TYPE_AS is done by
gfc_conv_same_type_as (trans-intrinsic.c), for both TYPE- and CLASS-valued
arguments.
Note: If both arguments are TYPE-valued, the result will be a compile-time
constant, otherwise it has to be evaluated at runtime, according to the _hash
values in the vtabs.
In which situations would we actually gain something by treating the TYPE-TYPE
case in simplify.c?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/41580] [OOP] SAME_TYPE_AS and EXTENDS_TYPE_OF - add compile-time simplifcation
[not found] <bug-41580-4@http.gcc.gnu.org/bugzilla/>
2011-01-05 12:16 ` [Bug fortran/41580] [OOP] SAME_TYPE_AS and EXTENDS_TYPE_OF - add compile-time simplifcation janus at gcc dot gnu.org
@ 2011-01-05 17:31 ` burnus at gcc dot gnu.org
2011-01-06 17:51 ` burnus at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-05 17:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41580
--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-05 17:19:45 UTC ---
Created attachment 22907
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22907
Draft patch - not fully working
(In reply to comment #4)
> Note: If both arguments are TYPE-valued, the result will be a compile-time
> constant, otherwise it has to be evaluated at runtime, according to the _hash
> values in the vtabs.
Well, extends_type_of can also be (sometimes) be evaluated at compile time for
CLASS.
> In which situations would we actually gain something
I assume that in practice it only matters for automatically generated code -
but there it might reduce the code size and improve the performance.
By the way: I think that's a 4.7 item.
* * *
I attached a draft patch. Note, however, that it does not work (cf. bottom of
patch/test case). For
if (extends_type_of(a11,b11) .neqv. .true.) call abort()
one enters gfc_simplify_extends_type_of twice: Once the second argument (mold)
is BT_CLASS (which give the correct result: NULL, i.e. not compile-time
simplifiable). But then again with mold being BT_DERIVED - which is then
compile-time simplified to .TRUE. as "a11" and "b11" are the same type.
I have not dug into this, but it seems to occur in two steps - first a normal
simplification happens, then a specific interface is used via
gfc_intrinsic_func_interface, which is then again simplified - but with
BT_DERIVED argument (base type). I think all gfc_simplify_* functions could be
affected.
TODO:
- Fix the double-simplification problem
- Add more test cases - I think the double-simplification also affects
same_type, but it is currently not tested for.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/41580] [OOP] SAME_TYPE_AS and EXTENDS_TYPE_OF - add compile-time simplifcation
[not found] <bug-41580-4@http.gcc.gnu.org/bugzilla/>
2011-01-05 12:16 ` [Bug fortran/41580] [OOP] SAME_TYPE_AS and EXTENDS_TYPE_OF - add compile-time simplifcation janus at gcc dot gnu.org
2011-01-05 17:31 ` burnus at gcc dot gnu.org
@ 2011-01-06 17:51 ` burnus at gcc dot gnu.org
2011-01-07 13:05 ` burnus at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-06 17:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41580
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #22907|0 |1
is obsolete| |
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-06 17:40:26 UTC ---
Created attachment 22914
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22914
Draft patch - should be OK
Updated patch, fixed the issue (but did not add more tests). On the way, I
encountered PR 47194.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/41580] [OOP] SAME_TYPE_AS and EXTENDS_TYPE_OF - add compile-time simplifcation
[not found] <bug-41580-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2011-01-06 17:51 ` burnus at gcc dot gnu.org
@ 2011-01-07 13:05 ` burnus at gcc dot gnu.org
2011-01-07 16:32 ` burnus at gcc dot gnu.org
2011-01-07 16:40 ` burnus at gcc dot gnu.org
5 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-07 13:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41580
--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-07 12:59:06 UTC ---
Submitted patch: http://gcc.gnu.org/ml/fortran/2011-01/msg00051.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/41580] [OOP] SAME_TYPE_AS and EXTENDS_TYPE_OF - add compile-time simplifcation
[not found] <bug-41580-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2011-01-07 13:05 ` burnus at gcc dot gnu.org
@ 2011-01-07 16:32 ` burnus at gcc dot gnu.org
2011-01-07 16:40 ` burnus at gcc dot gnu.org
5 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-07 16:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41580
--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-07 16:19:34 UTC ---
Author: burnus
Date: Fri Jan 7 16:19:29 2011
New Revision: 168579
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168579
Log:
2011-01-07 Tobias Burnus <burnus@net-b.de>
PR fortran/41580
* class.c (gfc_build_class_symbol): Mark __vtab as attr.vtab.
* intrinsic.c (add_functions): Use simplify functions for
EXTENDS_TYPE_OF and SAME_TYPE_AS.
* intrinsic.h (gfc_simplify_extends_type_of,
gfc_simplify_same_type_as): New prototypes.
* simplify.c (is_last_ref_vtab, gfc_simplify_extends_type_of,
gfc_simplify_same_type_as): New functions.
2011-01-07 Tobias Burnus <burnus@net-b.de>
PR fortran/41580
* gfortran.dg/extends_type_of_3.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/extends_type_of_3.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/intrinsic.c
trunk/gcc/fortran/intrinsic.h
trunk/gcc/fortran/simplify.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/41580] [OOP] SAME_TYPE_AS and EXTENDS_TYPE_OF - add compile-time simplifcation
[not found] <bug-41580-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2011-01-07 16:32 ` burnus at gcc dot gnu.org
@ 2011-01-07 16:40 ` burnus at gcc dot gnu.org
5 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-07 16:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41580
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-07 16:20:14 UTC ---
... and FIXED (on the 4.6 trunk).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/41580] [OOP] SAME_TYPE_AS and EXTENDS_TYPE_OF - add compile-time simplifcation
2009-10-05 12:41 [Bug fortran/41580] New: " burnus at gcc dot gnu dot org
2010-04-18 15:57 ` [Bug fortran/41580] " dominiq at lps dot ens dot fr
2010-04-18 16:21 ` burnus at gcc dot gnu dot org
@ 2010-04-18 16:47 ` dominiq at lps dot ens dot fr
2 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-04-18 16:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from dominiq at lps dot ens dot fr 2010-04-18 16:47 -------
> Currently, only the run-time version is implemented.
So could the pr marked as NEW?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41580
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/41580] [OOP] SAME_TYPE_AS and EXTENDS_TYPE_OF - add compile-time simplifcation
2009-10-05 12:41 [Bug fortran/41580] New: " burnus at gcc dot gnu dot org
2010-04-18 15:57 ` [Bug fortran/41580] " dominiq at lps dot ens dot fr
@ 2010-04-18 16:21 ` burnus at gcc dot gnu dot org
2010-04-18 16:47 ` dominiq at lps dot ens dot fr
2 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-04-18 16:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from burnus at gcc dot gnu dot org 2010-04-18 16:21 -------
> Could this PR be more explicit about the problem?
No it cannot; as written: For SAME_TYPE_AS and EXTENDS_TYPE_OF one should add a
compile-time simplification to simplify.c.
Currently, only the run-time version is implemented.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41580
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/41580] [OOP] SAME_TYPE_AS and EXTENDS_TYPE_OF - add compile-time simplifcation
2009-10-05 12:41 [Bug fortran/41580] New: " burnus at gcc dot gnu dot org
@ 2010-04-18 15:57 ` dominiq at lps dot ens dot fr
2010-04-18 16:21 ` burnus at gcc dot gnu dot org
2010-04-18 16:47 ` dominiq at lps dot ens dot fr
2 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-04-18 15:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from dominiq at lps dot ens dot fr 2010-04-18 15:56 -------
I cannot reproduce the error at
http://gcc.gnu.org/ml/fortran/2009-09/msg00298.html neither with trunk nor with
fortran-dev. Could this PR be more explicit about the problem?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41580
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-01-07 16:20 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-41580-4@http.gcc.gnu.org/bugzilla/>
2011-01-05 12:16 ` [Bug fortran/41580] [OOP] SAME_TYPE_AS and EXTENDS_TYPE_OF - add compile-time simplifcation janus at gcc dot gnu.org
2011-01-05 17:31 ` burnus at gcc dot gnu.org
2011-01-06 17:51 ` burnus at gcc dot gnu.org
2011-01-07 13:05 ` burnus at gcc dot gnu.org
2011-01-07 16:32 ` burnus at gcc dot gnu.org
2011-01-07 16:40 ` burnus at gcc dot gnu.org
2009-10-05 12:41 [Bug fortran/41580] New: " burnus at gcc dot gnu dot org
2010-04-18 15:57 ` [Bug fortran/41580] " dominiq at lps dot ens dot fr
2010-04-18 16:21 ` burnus at gcc dot gnu dot org
2010-04-18 16:47 ` 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).