------- Comment #12 from burnus at gcc dot gnu dot org  2010-06-22 14:42 -------
(In reply to comment #11)
> What's the reason why gfc_trans_zero_assign insists that len is INTEGER_CST?
> At least if it is contiguous (and not assumed size), why can't memset be used
> even for non-constant sizes?

Suggested by Jakub: 

 -  if (!len || TREE_CODE (len) != INTEGER_CST)
 +  if (!len
 +      || (TREE_CODE (len) != INTEGER_CST
 +          && !gfc_is_simply_contiguous (expr, false)))

Though, one needs to be careful that one zeros the right spot (maybe already
taken care of):
  a(5:) = 0

Additionally, one could do the same for arrays which are contiguous but have a
descriptor - for which one has to calculate the size manually (as "len" ==
NULL). At least after memset/memcpy middle-end fixes, the change should be
profitable.


-- 


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

Reply via email to