[Bug fortran/97571] long parsing phase for simple array constructor

anlauf at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Oct 26 14:46:07 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97571

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #1 from anlauf at gcc dot gnu.org ---
Looking at the dump-tree of a reduced case reveals that simplification
of the line with the ACOS of the array constructor causes the difference:

subroutine bpr_init
  implicit none
  integer :: i
  real :: tacos2(2)
  tacos2 = acos( (/ (i, i=1,size(tacos2)) /) / 2.0)
end subroutine bpr_init


11-master:

bpr_init ()
{
  integer(kind=4) i;
  real(kind=4) tacos2[2];

  {
    static real(kind=4) A.0[2] = {1.0471975803375244140625e+0, 0.0};

    (void) __builtin_memcpy ((void *) &tacos2, (void *) &A.0, 8);
  }
}


older versions:

bpr_init ()
{
  integer(kind=4) i;
  real(kind=4) tacos2[2];

  {
    static real(kind=4) A.0[2] = {5.0e-1, 1.0e+0};

    {
      integer(kind=8) S.1;

      S.1 = 0;
      while (1)
        {
          if (S.1 > 1) goto L.1;
          tacos2[S.1] = __builtin_acosf (A.0[S.1]);
          S.1 = S.1 + 1;
        }
      L.1:;
    }
  }
}


So the new compiler does compile-time simplification already at -O0, while
older versions maybe not.


More information about the Gcc-bugs mailing list