[Bug fortran/38114] unneeded temp

2012-02-19 Thread tkoenig at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38114

Thomas Koenig  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution||INVALID

--- Comment #4 from Thomas Koenig  2012-02-19 
19:14:32 UTC ---
Closing as invalid (nobody spoke up), just to keep the bug list
a bit more tidy.


[Bug fortran/38114] unneeded temp

2012-02-11 Thread tkoenig at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38114

Thomas Koenig  changed:

   What|Removed |Added

 Status|NEW |WAITING
 CC||tkoenig at gcc dot gnu.org

--- Comment #3 from Thomas Koenig  2012-02-11 
09:31:08 UTC ---
I also think this is not a missed optimization. We need a temporary
for the write statement anyway.

I vote for closing this.

Setting to WAITING, if somebody else concurs please close.


[Bug fortran/38114] unneeded temp

2009-03-29 Thread fxcoudert at gcc dot gnu dot org


-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

   Severity|normal  |enhancement
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2009-03-29 08:27:46
   date||


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



[Bug fortran/38114] unneeded temp

2008-11-19 Thread jv244 at cam dot ac dot uk


--- Comment #2 from jv244 at cam dot ac dot uk  2008-11-19 13:08 ---
(In reply to comment #1)
> SUBROUTINE S(b,i,j)
> INTEGER, DIMENSION(:) :: b
> integer res(1)
> INTEGER :: i,j
> res = MINLOC(b(i:j))
> END SUBROUTINE S

right.. the 'orginal' testcase was. Actually, these temps are all derived for
CP2K sources.

SUBROUTINE S(b,i,j)
INTEGER, DIMENSION(:) :: b
integer res
INTEGER :: i,j
res = SUM(MINLOC(b(i:j)))
END SUBROUTINE S


-- 


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



[Bug fortran/38114] unneeded temp

2008-11-18 Thread pault at gcc dot gnu dot org


--- Comment #1 from pault at gcc dot gnu dot org  2008-11-18 20:09 ---
This produces the code:

s (struct array1_integer(kind=4) & b, integer(kind=4) & i, integer(kind=4) & j)
{
  integer(kind=8) ubound.0;
  integer(kind=8) stride.1;
  integer(kind=8) offset.2;
  integer(kind=8) size.3;
  integer(kind=4)[0:D.1562] * b.0;
  integer(kind=8) D.1562;
  bit_size_type D.1563;
   D.1564;

  {
integer(kind=8) D.1561;

D.1561 = b->dim[0].stride;
stride.1 = D.1561 != 0 ? D.1561 : 1;
b.0 = (integer(kind=4)[0:D.1562] *) b->data;
ubound.0 = (b->dim[0].ubound - b->dim[0].lbound) + 1;
size.3 = stride.1 * NON_LVALUE_EXPR ;
offset.2 = -stride.1;
D.1562 = size.3 + -1;
D.1563 = (bit_size_type) size.3 * 32;
D.1564 = () size.3 * 4;
  }
  {
struct __st_parameter_dt dt_parm.4;

dt_parm.4.common.filename = &"pr38114.f90"[1]{lb: 1 sz: 1};
dt_parm.4.common.line = 4;
dt_parm.4.common.flags = 128;
dt_parm.4.common.unit = 6;
_gfortran_st_write (&dt_parm.4);
{
  integer(kind=4) A.7[1];
  struct array1_integer(kind=4) atmp.6;
  integer(kind=8) D.1554;
  integer(kind=8) D.1553;
  struct array1_integer(kind=4) parm.5;
  integer(kind=8) D.1551;
  integer(kind=8) D.1550;

  D.1550 = (integer(kind=8)) *i;
  D.1551 = (integer(kind=8)) *j;
  parm.5.dtype = 265;
  D.1553 = offset.2;
  D.1554 = stride.1;
  parm.5.dim[0].lbound = 1;
  parm.5.dim[0].ubound = (1 - D.1550) + D.1551;
  parm.5.dim[0].stride = NON_LVALUE_EXPR ;
  parm.5.data = (void *) &(*b.0)[(D.1550 + -1) * D.1554];
  parm.5.offset = (1 - D.1550) * stride.1 + D.1553;
  atmp.6.dtype = 265;
  atmp.6.dim[0].stride = 1;
  atmp.6.dim[0].lbound = 0;
  atmp.6.dim[0].ubound = 0;
  atmp.6.data = (void *) &A.7;
  atmp.6.offset = 0;
  _gfortran_minloc0_4_i4 (&atmp.6, &parm.5);
  {
integer(kind=8) S.8;

S.8 = 0;
while (1)
  {
if (S.8 > 0) goto L.1;
{
  integer(kind=4) D.1559;

  D.1559 = (*(integer(kind=4)[1] *) atmp.6.data)[S.8];
  _gfortran_transfer_integer (&dt_parm.4, &D.1559, 4);
}
S.8 = S.8 + 1;
  }
L.1:;
  }
}
_gfortran_st_write_done (&dt_parm.4);
  }
}

This does indeed produce a temporary for the result.  The argument is a
descriptor with 'b' as the 'data'.  The result, being rank 1, is a stack array
of size = 1.  I think that this is not a missed optimisation.

For
SUBROUTINE S(b,i,j)
INTEGER, DIMENSION(:) :: b
integer res(1)
INTEGER :: i,j
res = MINLOC(b(i:j))
END SUBROUTINE S

No temporary is produced.

Paul


-- 


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