public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57992] New: Pointless packing of contiguous arrays for simply contiguous functions results as actual arguments
@ 2013-07-26 11:05 burnus at gcc dot gnu.org
2013-07-28 16:36 ` [Bug fortran/57992] " burnus at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-07-26 11:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57992
Bug ID: 57992
Summary: Pointless packing of contiguous arrays for simply
contiguous functions results as actual arguments
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
allocatables, pointer+contiguous and explicit-size arrays are all (simply)
contiguous.
However, gfortran adds _gfortran_internal_pack/_gfortran_internal_unpack calls
in all three cases:
subroutine test
interface
function f1()
integer, allocatable :: f1(:)
end function f1
function f2()
integer, pointer, contiguous :: f2(:)
end function f2
function f3()
integer :: f3(5)
end function f3
end interface
call bar(f1())
call bar(f2())
call bar(f3())
end subroutine test
!call test()
!end
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/57992] Pointless packing of contiguous arrays for simply contiguous functions results as actual arguments
2013-07-26 11:05 [Bug fortran/57992] New: Pointless packing of contiguous arrays for simply contiguous functions results as actual arguments burnus at gcc dot gnu.org
@ 2013-07-28 16:36 ` burnus at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-07-28 16:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57992
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Draft patch:
* Handles POINTER (-> temporary), POINTER, CONTIGUOUS (-> no temporary) and
ALLOCATABLE (->no temporary)
TODO
* Nonpointers, nonallocatables (like f3) are *not* handled (why?)
* Check whether TBP or PPC are handled correctly
* Check whether sym == sym->result and sym != sym->result are handled
* Check whether CLASS is handled correctly
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -7012,6 +7012,11 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr,
bool g77,
if (expr->expr_type == EXPR_VARIABLE && ref && !ultimate_ptr_comp)
full_array_var = gfc_full_array_ref_p (ref, &contiguous);
+ else if (expr->expr_type == EXPR_FUNCTION)
+ {
+ symbol_attribute attr = gfc_expr_attr (expr);
+ contiguous = !attr.pointer || attr.contiguous;
+ }
sym = full_array_var ? expr->symtree->n.sym : NULL;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-28 16:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-26 11:05 [Bug fortran/57992] New: Pointless packing of contiguous arrays for simply contiguous functions results as actual arguments burnus at gcc dot gnu.org
2013-07-28 16:36 ` [Bug fortran/57992] " 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).