------- Comment #27 from dominiq at lps dot ens dot fr  2010-05-09 14:19 -------
> VEC_safe_push is quite safe, actually. But it may re-allocate the VEC. If you
> really believe that VEC_safe_push is the problem here, then you should perhaps
> look if a VEC is being passed around incorrectly somewhere, so that
> reallocating it would make things disappear.

Could you give me more precise idea about what I am supposed to do to "look if
a VEC is being passed around incorrectly somewhere"? BTW I would think the
problem is not before some "reallocation", but after it, see:

   ... .  The latter will reallocate the
   vector, if needed.  Reallocation causes an exponential increase in
   vector size.  ....

I have found a long comment at the beginning of gcc/vec.h, is VEC_safe_push
documented elsewhere?

I have done the following changes in the subroutine s00009.f90:

(1) 

--- s00009.f90  2010-04-18 22:04:36.000000000 +0200
+++ s00009_yy.f90       2010-05-09 15:19:43.000000000 +0200
@@ -45,6 +45,7 @@
      &                NDPdt , NDBsor , NHSor
       DOUBLE PRECISION M , cc(22,2)
       coef = 144.D+00/778.D+00
+      zzz = 1.0/VVFs
       DO i = 2 , NC1
         j = i - 1
         ity = ITYp(i)

and I get the same assembly compared with the original one (for both revision
159105 and 159106).

(2)

--- s00009.f90  2010-04-18 22:04:36.000000000 +0200
+++ s00009_xx.f90       2010-05-09 15:22:25.000000000 +0200
@@ -45,6 +45,7 @@
      &                NDPdt , NDBsor , NHSor
       DOUBLE PRECISION M , cc(22,2)
       coef = 144.D+00/778.D+00
+      zzz = 1.0/VVFs
       DO i = 2 , NC1
         j = i - 1
         ity = ITYp(i)
@@ -76,7 +77,7 @@
            AA(i,k) = VV(i,k)*DM(i,k) + DVVh(i,k)*cc(i,k)
            DV(i,k) = AA(i,k) + BB(i,k)*DPDt
            IF ( DABS(DV(i,k)).LT.1.D-10 ) DV(i,k) = 0.D+00
-           epsm = DELm*VC(i)/VVFs
+           epsm = DELm*VC(i)*zzz
            ym = M(i,k)
            IF ( ym.LT.epsm ) ym = epsm
            DH(i,k) = (cc(i,k)+coef*V(i,k)*DPDt)/ym

i.e., I have replaced the division with the multiplication by the inverse (if I
am not mistaken, this optimization is done with revision 159105 but not with
159106). The assembly is very different and the executable does not crash.


-- 


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

Reply via email to