On Thu, Jan 25, 2018 at 11:07:04AM -0800, Steve Kargl wrote: > On Thu, Jan 25, 2018 at 07:58:22PM +0100, Thomas Koenig wrote: > > Hi Steve, > > > > thanks for your explanations. > > > > The patch is OK for trunk. Thanks a lot! > > > > Upon even further reading, the code segment with temp might > be needed. If one looks in compute_dot_product(), one finds > > result = gfc_get_constant_expr (matrix_a->ts.type, matrix_a->ts.kind, > &matrix_a->where); > init_result_expr (result, 0, NULL); > > which sets the type of result to matrix_a, unconditionally. > We may however still benefit from mixed-mode math during > the summation because we have > > result = gfc_add (result, gfc_multiply (c, gfc_copy_expr (b))); > > and both gfc_add and gfc_multiply should do mixed-mode math. > > I'll check before I commit.
This code confirms proper handling of mixed-mode math. program p integer, parameter :: a(2) = [1, 2] real, parameter :: b(2) = [1., 2.] real c c = dot_product(a,b) print *, c end -- Steve