Bug 30969 - [4.3 Regression] The polyhedron test 'fatigue.f90' is no longer working.
Summary: [4.3 Regression] The polyhedron test 'fatigue.f90' is no longer working.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.3.0
: P1 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on: 30980
Blocks:
  Show dependency treegraph
 
Reported: 2007-02-26 13:28 UTC by Dominique d'Humieres
Modified: 2018-05-19 13:46 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc-apple-darwin7
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
this test works only without optimization (3.07 KB, text/plain)
2007-02-26 13:30 UTC, Dominique d'Humieres
Details
test working with -O3 -ffast-math -funroll-loops (3.44 KB, text/plain)
2007-02-26 13:31 UTC, Dominique d'Humieres
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique d'Humieres 2007-02-26 13:28:53 UTC
With powerpc-apple-darwin7.9.0, version 4.3.0 20070223,
the polyhedron test 'fatigue.f90' (see
http://www.polyhedron.co.uk/pb05/polyhedron_benchmark_suite.html)
gives

...
Simulation terminated.
This sample will never fracture.
The imposed stress is below the fatigue limit.
See the output file for more information.

with optimisation -O1 and above.

It worked with 4.3.0 20070217. If I add the line

               if(coefficient == 1000.0) print *, n, coefficient  

after line 1428, the code works again.

I am attaching two reduced tests. The first one works without optimization,
gives

Simulation terminated.
     Spin cycle =           100000
     Time (sec)       =     2.77778E+01
The maximum number of simulation spin cycles was exceeded.

with -O1, and

This sample will never fracture.
The imposed stress is below the fatigue limit.

with -O2.

The second test is similar to the previous one but works with
-O3 -ffast-math -funroll-loops
I have commented several variants which break the code.
Of special interest is !4 where

              if (accumulated_plastic_strain < plastic_strain_threshold) then                 
              else
                                                                            
is working, but not

              if (accumulated_plastic_strain >= plastic_strain_threshold) then              



Note that there is also some problems with the test 'induct.f90' see

http://gcc.gnu.org/ml/fortran/2007-02/msg00554.html
Comment 1 Dominique d'Humieres 2007-02-26 13:30:36 UTC
Created attachment 13114 [details]
this test works only without optimization
Comment 2 Dominique d'Humieres 2007-02-26 13:31:28 UTC
Created attachment 13115 [details]
test working with -O3 -ffast-math -funroll-loops
Comment 3 Richard Biener 2007-02-26 17:34:51 UTC
Still works on x86_64, so it's a target issue.
Comment 4 Dominique d'Humieres 2007-02-26 17:50:55 UTC
Subject: Re:  The polyhedron test 'fatigue.f90' is no longer working.

> Still works on x86_64, so it's a target issue.

Nevertheless a regression.
Comment 5 Andrew Pinski 2007-02-26 17:54:20 UTC
> Still works on x86_64, so it's a target issue.

There really has not been any rs6000 changes lately so I am going to say middle-end until I get to look into it on powerpc-linux-gnu.
Comment 6 Dominique d'Humieres 2007-02-27 15:36:29 UTC
I don't know if this reduced test account for all the problem, but it exhibits at least one bug:

module perdida_m
implicit none
contains
      subroutine perdida (dt, strain_tensor)
      real (kind = 8), intent(in) :: dt
      real (kind = 8), dimension(:,:), intent(in) :: strain_tensor
      end subroutine perdida
end module perdida_m

program iztaccihuatl
      use perdida_m
      implicit none
      real (kind = 8) :: dt, time, coefficient
      real (kind = 8), dimension(3,3,10) :: strain_tensor
      dt = 5.555555555555556D-006 
      strain_tensor = 0.0_8
      time = dt
      coefficient = sin(time)
      print *, coefficient
      coefficient = cos(time)
      call perdida (dt, strain_tensor(:,:,1))
end program iztaccihuatl

gives

  1.947453947074031E-314

If I comment the line 'call perdida (dt, strain_tensor(:,:,1))', I get

  5.555555555526978E-006

As far as I can tell, all the ingredients in this test case are necessary to trigger the bug.
Comment 7 Andrew Pinski 2007-02-27 15:41:07 UTC
Related to PR30980.
Comment 8 Dominique d'Humieres 2007-03-17 00:27:52 UTC
Thanks to Richard Guenther, the bug seems to be fixed (hopefully in the 20070316 snapshot):
see PR31161 for details.

I'll comment in another PR about the corresponding "optimization" (too late to do it tonight).
Comment 9 Mark Mitchell 2007-06-29 17:59:47 UTC
This is reported fixed; can we close this PR?
Comment 10 Steven Bosscher 2007-08-07 21:01:24 UTC
Never confirmed, and reported says the bug seems to be fixed.

If the bug is still there, please re-open this PR.