Am 03.07.2013 14:05, schrieb Tobias Burnus:
Thanks goes to Dominique for debugging the issue!

Build and regtested on x86-64-gnu-linux.
OK for the trunk? I think one should also backport it to 4.7/4.8. (Folding - and hence the bug - exist since GCC 4.5.)

For the trunk, committed as Rev. 200786 - using the attached test case as replacement for the original one.


Dominique Dhumieres wrote:
(2) I don't like the scan-tree-dump: they are fragile and have a limited
coverage. I'ld prefer a test such as the following
! { dg-do run }

And I really dislike "dg-do run" tests for compile-time simplifications. I think the attached test case should combine the best of the two worlds.

In general, I think one needs both: Many things aren't reliably testable with run-time tests. Thus, dumps help a lot: They have a *better* coverage of certain things and are usually quite robust. Having compile-only tests is also a tad faster. On the other hand, run tests are good to ensure that the interplay of different features works well.

Tobias
! { dg-do compile }
! { dg-options "-fdump-tree-original" }
!
! PR fortran/57785
!
! Contributed by Kontantinos Anagnostopoulos
!
! The implicit complex conjugate was missing for DOT_PRODUCT


! For the following, the compile-time simplification fails for SUM;
! see PR fortran/56342. Hence, a manually expanded SUM is used.

!if (DOT_PRODUCT ((/ (1.0, 2.0), (2.0, 3.0) /), (/ (1.0, 1.0), (1.0, 4.0) /))   &
!   /= SUM (CONJG ((/ (1.0, 2.0), (2.0, 3.0) /))*(/ (1.0, 1.0), (1.0, 4.0) /))) &
!   call abort ()
!
!if (ANY (MATMUL ((/ (1.0, 2.0), (2.0, 3.0) /),                                 &
!                 RESHAPE ((/ (1.0, 1.0), (1.0, 4.0) /),(/2, 1/))) /=           &
!         SUM ((/ (1.0, 2.0), (2.0, 3.0) /)*(/ (1.0, 1.0), (1.0, 4.0) /))))     &
!    call abort ()      


if (DOT_PRODUCT ((/ (1.0, 2.0), (2.0, 3.0) /), (/ (1.0, 1.0), (1.0, 4.0) /))  &
    /= CONJG (cmplx(1.0, 2.0)) * cmplx(1.0, 1.0)                              &
     + CONJG (cmplx(2.0, 3.0)) * cmplx(1.0, 4.0)) &
  call abort ()

if (ANY (MATMUL ((/ (1.0, 2.0), (2.0, 3.0) /),                                &
                 RESHAPE ((/ (1.0, 1.0), (1.0, 4.0) /),(/2, 1/)))             &
         /= cmplx(1.0, 2.0) * cmplx(1.0, 1.0)                                 &
          + cmplx(2.0, 3.0) * cmplx(1.0, 4.0)))                               &
  call abort ()      
end


! { dg-final { scan-tree-dump-not "abort" "original" } }
! { dg-final { cleanup-tree-dump "original" } }

Reply via email to