This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33341] New: unnecessary stores for array constructor
- From: "tkoenig at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Sep 2007 20:17:06 -0000
- Subject: [Bug fortran/33341] New: unnecessary stores for array constructor
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following idiom causes unnecessary runtime
overhead:
$ cat compare.f90
function foo(a,b,c,d)
logical :: foo
integer, intent(in):: a,b,c,d
foo = all((/ a, b, c /) /= d)
end function foo
$ gfortran -fdump-tree-optimized -O3 -S compare.f90
The *.optimized file shows
<bb 2>:
D.521 = (int4[0:] *) &A.2;
D.522 = *a;
(*D.521)[0] = D.522;
D.523 = *b;
(*D.521)[1] = D.523;
D.524 = *c;
(*D.521)[2] = D.524;
D.516 = *d;
The stores are unneeded, as the array itself could
be eliminated.
--
Summary: unnecessary stores for array constructor
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tkoenig at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33341