This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fortran] Really fix PR 56782


Le 14/04/2013 16:21, Thomas Koenig a Ãcrit :
> Hi Mikael,
> 
>>>
>>> -  (void) gfc_expr_walker (&fcn, callback_reduction, NULL);
>>
>> why remove this?
> 
> Because it is not needed, as the test case _46 shows.  No need
> to run this twice, it doesn't get better :-)
> 
Indeed, that's right.

>   gfc_internal_error ("Illegal id in insert_iterator_function");
>>
>> This duplicated code could probably be merged with
>> copy_walk_reduction_arg.
> 
> I thought about it. The reason why I didn't do it was
> because the expr to be wrapped inside the call is different.
Hum, how different?

> I think callback_reduction's iterator handling
>> should happen there as well.
> 
> Like I said, it is done automatically by the expression
> walker.
> 
I don't really understand.
Attached is what I had in mind.
And a testcase (the '|| expr->expr_type == EXPR_FUNCTION' in
copy_walk_reduction_arg appeared wrong to me, and it was seemingly).

Mikael


Attachment: pr56872_modified.diff
Description: Text document

! { dg-do run }
! { dg-options "-ffrontend-optimize -fdump-tree-original" }
! Test that nested array constructors are optimized.
program main
  implicit none
  integer, parameter :: dp=selected_real_kind(15)
  real(kind=dp), dimension(2,2) :: a
  real(kind=dp) thirteen

  data a /2._dp,3._dp,5._dp,7._dp/
  thirteen = 13._dp
  if (abs (product([[sum([eleven_ones()]), thirteen], a]) - 30030._dp) > 1e-8) call abort
 contains
  function eleven_ones()
    real(kind=dp) :: eleven_ones(11)
    integer       :: i

    eleven_ones = [ (1._dp, i=1,11) ]
  end function eleven_ones
end program main
! { dg-final { scan-tree-dump-times "while" 4 "original" } }
! { dg-final { cleanup-tree-dump "original" } }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]