[Bug fortran/40598] Some missed optimizations in array assignment

2019-01-22 Thread juergen.reuter at desy dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40598

Jürgen Reuter  changed:

   What|Removed |Added

 CC||juergen.reuter at desy dot de

--- Comment #13 from Jürgen Reuter  ---
This seems to have been forgotten, it is still assigned. Is there any progress
on this one?

[Bug fortran/40598] Some missed optimizations in array assignment

2010-05-08 Thread pault at gcc dot gnu dot org


--- Comment #11 from pault at gcc dot gnu dot org  2010-05-08 12:57 ---
(In reply to comment #10)
 (In reply to comment #9)
  It even works!
 
 Paul, any news here? This looks very useful!
 See also PR41137.
 

Daniel,

I totally forgot about this one.  I had a first tinker since comment #9 and it
looks to be do-able.

I'll put it on the list.

Paul


-- 


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



[Bug fortran/40598] Some missed optimizations in array assignment

2010-05-08 Thread dfranke at gcc dot gnu dot org


--- Comment #12 from dfranke at gcc dot gnu dot org  2010-05-08 20:58 
---
Paul, I'm always unsure with these kind of things; PR31009 and PR31016 may, or
may not, be more of the same ...


-- 


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



[Bug fortran/40598] Some missed optimizations in array assignment

2010-05-07 Thread dfranke at gcc dot gnu dot org


--- Comment #10 from dfranke at gcc dot gnu dot org  2010-05-07 21:02 
---
(In reply to comment #9)
 It even works!

Paul, any news here? This looks very useful!
See also PR41137.


-- 

dfranke at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||dfranke at gcc dot gnu dot
   ||org


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



[Bug fortran/40598] Some missed optimizations in array assignment

2009-07-01 Thread burnus at gcc dot gnu dot org


--- Comment #5 from burnus at gcc dot gnu dot org  2009-07-01 07:51 ---
(In reply to comment #4)
Here, I do not get any segfault/problem with valgrind (for gfortran and a.out).

   tmp =  build4 (ARRAY_RANGE_REF, TREE_TYPE (dest), dest, 
   build_int_cst (gfc_array_index_type, 3),

I actually do not understand why 3 works. If I read gccint (cf. comment 2)
correctly I would have expect that one needs to passe the byte size. But it
seems to work as the dump / a.out indicates.


-- 


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



[Bug fortran/40598] Some missed optimizations in array assignment

2009-07-01 Thread pault at gcc dot gnu dot org


--- Comment #6 from pault at gcc dot gnu dot org  2009-07-01 08:23 ---
I might as well confirm it:-)

Paul


-- 

pault at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2009-07-01 08:23:08
   date||


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



[Bug fortran/40598] Some missed optimizations in array assignment

2009-07-01 Thread rguenth at gcc dot gnu dot org


--- Comment #7 from rguenth at gcc dot gnu dot org  2009-07-01 09:43 ---
  tmp =  build4 (ARRAY_RANGE_REF, TREE_TYPE (dest), dest, 
  build_int_cst (gfc_array_index_type, 3),
  NULL_TREE, NULL_TREE);

to set the upper bound correctly you have to build a new array type instead
of re-using TREE_TYPE (dest).  The types TYPE_DOMAIN will specify the size
of the slice.  Thus,

  slice_type = build_array_type (TREE_TYPE (TREE_TYPE (dest)),
 build_index_type (build_int_cst
(gfc_array_index_type, slice-size - 1)));

Richard.


-- 


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



[Bug fortran/40598] Some missed optimizations in array assignment

2009-07-01 Thread pault at gcc dot gnu dot org


--- Comment #8 from pault at gcc dot gnu dot org  2009-07-01 10:51 ---
Richard,

 to set the upper bound correctly you have to build a new array type instead
 of re-using TREE_TYPE (dest).  The types TYPE_DOMAIN will specify the size
 of the slice.  Thus,
 
   slice_type = build_array_type (TREE_TYPE (TREE_TYPE (dest)),
  build_index_type (build_int_cst
 (gfc_array_index_type, slice-size - 1)));

Brilliant! Thanks

Paul


-- 

pault at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|WAITING


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



[Bug fortran/40598] Some missed optimizations in array assignment

2009-07-01 Thread pault at gcc dot gnu dot org


--- Comment #9 from pault at gcc dot gnu dot org  2009-07-01 11:02 ---
Richard,

It even works!

Thanks again

Paul


-- 

pault at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|WAITING |ASSIGNED
   Last reconfirmed|2009-07-01 08:23:08 |2009-07-01 11:02:14
   date||


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



[Bug fortran/40598] Some missed optimizations in array assignment

2009-06-30 Thread pault at gcc dot gnu dot org


--- Comment #4 from pault at gcc dot gnu dot org  2009-06-30 12:57 ---
Modifying trans-expr (gfc_trans_zero_assign) to:

  tmp =  build4 (ARRAY_RANGE_REF, TREE_TYPE (dest), dest, 
  build_int_cst (gfc_array_index_type, 3),
  NULL_TREE, NULL_TREE);

  /* If we are zeroing a local array avoid taking its address by emitting
 a = {} instead.  */
  if (!POINTER_TYPE_P (TREE_TYPE (dest)))
return build2 (MODIFY_EXPR, void_type_node,
   tmp, build_constructor (TREE_TYPE (tmp), NULL));

produces:

  array[3 ...] = {};
  {
struct __st_parameter_dt dt_parm.2;

dt_parm.2.common.filename = test.f90[1]{lb: 1 sz: 1};
dt_parm.2.common.line = 4;
dt_parm.2.common.flags = 128;
dt_parm.2.common.unit = 6;
_gfortran_st_write (dt_parm.2);

for:

  integer :: array (3, 3)
  array = 1
  array = 0
  print *, array
end

and the output is:

[...@localhost tmp]# ./a.out
   1   1   1   0   0   0   
   0   0   0
Segmentation fault

So the lower bound for the reference seems to be OK but I have not understood
how to set the upper bound.  If I set argument three, the lower bound is reset
to zero and the size of the array reference is determined by arg 3.  This also
gets rid of the seg fault.

I obviously do not have the faintest idea of what I am doing!  I notice as well
that the ARRAY_RANGE_REF is not used very much.

Paul


-- 


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