public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/42831] New: Unneccessary array temporary produced
@ 2010-01-21 16:19 burnus at gcc dot gnu dot org
2010-05-09 22:13 ` [Bug fortran/42831] Unnecessary " dfranke at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-01-21 16:19 UTC (permalink / raw)
To: gcc-bugs
Topic arose during analyzing/fixing PR 42736. For the
Table%RealData(:,1) = Table%RealData(:,1) * CENTIMETER
user-defined operation(*)/assignment an unnecessary temporary is produced. (The
"atmp" in the dump is not needed.)
An initial patch can be found at
http://gcc.gnu.org/ml/fortran/2010-01/msg00100.html (Read complete thread.)
which needs some checking for correctness.
--
Summary: Unneccessary array temporary produced
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42831
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/42831] Unnecessary array temporary produced
2010-01-21 16:19 [Bug fortran/42831] New: Unneccessary array temporary produced burnus at gcc dot gnu dot org
@ 2010-05-09 22:13 ` dfranke at gcc dot gnu dot org
2010-09-13 18:59 ` tkoenig at gcc dot gnu dot org
2010-09-13 19:04 ` jakub at gcc dot gnu dot org
2 siblings, 0 replies; 6+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-09 22:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from dfranke at gcc dot gnu dot org 2010-05-09 22:13 -------
Somewhat reduced testcase below.
Note that the temporary depends on the POINTER attribute of 'table'. If POINTER
and corresponding ALLOCATE are removed, there is no more temporary array. Also,
if CENTIMETER is changed to simple REAL, but 'table' is still a POINTER, the
temporary is omitted.
module UnitValue_Module
type :: UnitValue
real :: Value = 1.0
end type
interface operator(*)
module procedure ProductReal_LV
end interface operator(*)
interface assignment(=)
module procedure Assign_LV_Real
end interface assignment(=)
contains
elemental function ProductReal_LV(Multiplier, Multiplicand) result(P_R_LV)
real, intent(in) :: Multiplier
type(UnitValue), intent(in) :: Multiplicand
type(UnitValue) :: P_R_LV
P_R_LV%Value = Multiplier * Multiplicand%Value
end function ProductReal_LV
elemental subroutine Assign_LV_Real(LeftHandSide, RightHandSide)
real, intent(inout) :: LeftHandSide
type(UnitValue), intent(in) :: RightHandSide
LeftHandSide = RightHandSide%Value
end subroutine Assign_LV_Real
end module UnitValue_Module
program TestProgram
use UnitValue_Module
type :: TableForm
real, dimension(:,:), allocatable :: RealData
end type TableForm
REAL :: CENTIMETER
type(TableForm), pointer :: Table
allocate(Table)
allocate(Table%RealData(10,5))
CENTIMETER = 42
Table%RealData = 1
Table%RealData(:,1) = Table%RealData(:,1) * CENTIMETER
end program TestProgram
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
OtherBugsDependingO| |36854
nThis| |
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-05-09 22:13:05
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42831
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/42831] Unnecessary array temporary produced
2010-01-21 16:19 [Bug fortran/42831] New: Unneccessary array temporary produced burnus at gcc dot gnu dot org
2010-05-09 22:13 ` [Bug fortran/42831] Unnecessary " dfranke at gcc dot gnu dot org
@ 2010-09-13 18:59 ` tkoenig at gcc dot gnu dot org
2010-09-13 19:04 ` jakub at gcc dot gnu dot org
2 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2010-09-13 18:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from tkoenig at gcc dot gnu dot org 2010-09-13 18:59 -------
This doesn't seem to happen any more.
Can we close this?
--
tkoenig at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tkoenig at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42831
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/42831] Unnecessary array temporary produced
2010-01-21 16:19 [Bug fortran/42831] New: Unneccessary array temporary produced burnus at gcc dot gnu dot org
2010-05-09 22:13 ` [Bug fortran/42831] Unnecessary " dfranke at gcc dot gnu dot org
2010-09-13 18:59 ` tkoenig at gcc dot gnu dot org
@ 2010-09-13 19:04 ` jakub at gcc dot gnu dot org
2 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-09-13 19:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2010-09-13 19:04 -------
Perhaps a testcase should be added (either with -Warray-temporaries or scanning
dumps) to make sure we don't regress here?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42831
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/42831] Unnecessary array temporary produced
[not found] <bug-42831-4@http.gcc.gnu.org/bugzilla/>
2010-10-02 8:01 ` tkoenig at gcc dot gnu.org
@ 2010-10-02 8:06 ` tkoenig at gcc dot gnu.org
1 sibling, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-10-02 8:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42831
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-10-02 08:06:21 UTC ---
Test case committed.
Closing.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/42831] Unnecessary array temporary produced
[not found] <bug-42831-4@http.gcc.gnu.org/bugzilla/>
@ 2010-10-02 8:01 ` tkoenig at gcc dot gnu.org
2010-10-02 8:06 ` tkoenig at gcc dot gnu.org
1 sibling, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-10-02 8:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42831
--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-10-02 08:00:55 UTC ---
Author: tkoenig
Date: Sat Oct 2 08:00:50 2010
New Revision: 164900
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164900
Log:
2010-10-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/42831
* gfortran.dg/dependency_37.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/dependency_37.f90
Modified:
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-10-02 8:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-21 16:19 [Bug fortran/42831] New: Unneccessary array temporary produced burnus at gcc dot gnu dot org
2010-05-09 22:13 ` [Bug fortran/42831] Unnecessary " dfranke at gcc dot gnu dot org
2010-09-13 18:59 ` tkoenig at gcc dot gnu dot org
2010-09-13 19:04 ` jakub at gcc dot gnu dot org
[not found] <bug-42831-4@http.gcc.gnu.org/bugzilla/>
2010-10-02 8:01 ` tkoenig at gcc dot gnu.org
2010-10-02 8:06 ` tkoenig 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).