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



--- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> 2013-01-06 18:48:07 
UTC ---

Created attachment 29089

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29089

modified version of one of the failing tests



Confirmed



This is a failure of the scalarizer, which is why I have bumped up its

importance.



The final invocation of SPLIT, from within a scalarizer loop, is passing the

character argument CHAR(set) as a pointer to a pointer.



Replacing this call with one to a contained function foo (see attachment),

results in success for 'choice' 0 or 2 (explicit loop or passing VST, rather

than character)

subroutine foo (choice)

  integer :: choice

  if (choice == 1) then

    CALL SPLIT(strar,wrdar,CHAR(set),separ)

  else if (choice == 2) then

    CALL SPLIT(strar,wrdar,set,separ)

  else

    DO i=1,ndim

      DO j=1,ndim

        CALL SPLIT(strar(i,j),wrdar(i,j),CHAR(set),separ(i,j))

      end do

    end do

  end if

end subroutine 



The code produced by this appears below and is the reason for my assertion that

this is a scalarizer problem.  I suspect from inspection that VST30/31 fail for

the same reason.



I have added Mikael in copy, hoping that his more recent exposure to the

scalarizer will help identify the root cause more quickly.



Cheers



Paul



foo (integer(kind=4) & restrict choice)

{

  if (*choice == 1)

    {

      {

        character(kind=1)[1:MAX_EXPR <D.2015, 0>] * D.2020;

        void * restrict D.2018;

        integer(kind=4) D.2017;

        character(kind=1)[1:MAX_EXPR <D.2015, 0>] * pstr.26;

        integer(kind=4) D.2015;

        struct varying_string * D.2014;



        D.2014 = &set;

        D.2015 = len_ (D.2014);

        D.2017 = MAX_EXPR <D.2015, 0> * 64;

        D.2018 = (void * restrict) __builtin_malloc (MAX_EXPR <(unsigned long)

D.2017, 1>);

        pstr.26 = (character(kind=1)[1:MAX_EXPR <D.2015, 0>] *) D.2018;

        char_auto (pstr.26, MAX_EXPR <D.2015, 0>, D.2014);

        D.2020 = pstr.26;

        {

          integer(kind=8) S.27;



          S.27 = 1;

          while (1)

            {

              if (S.27 > 2) goto L.10;

              {

                integer(kind=8) D.2025;

                integer(kind=8) D.2024;

                integer(kind=8) D.2023;

                integer(kind=8) S.28;



                D.2023 = S.27 * 2 + -3;

                D.2024 = S.27 * 2 + -3;

                D.2025 = S.27 * 2 + -3;

                S.28 = 1;

                while (1)

                  {

                    if (S.28 > 2) goto L.9;

                    split_ch (&strar[S.28 + D.2023], &wrdar[S.28 + D.2024],

&D.2020, &separ[S.28 + D.2025], 0B, MAX_EXPR <D.2015, 0>);

                    S.28 = S.28 + 1;

                  }

                L.9:;

              }

              S.27 = S.27 + 1;

            }

          L.10:;

        }

        {

          void * D.2019;



          D.2019 = (void *) pstr.26;

          if (D.2019 != 0B)

            {

              __builtin_free (D.2019);

            }

        }

      }

    }

  else

    {

      if (*choice == 2)

        {

          {

            struct varying_string D.2029;



            D.2029 = set;

            {

              integer(kind=8) S.29;



              S.29 = 1;

              while (1)

                {

                  if (S.29 > 2) goto L.12;

                  {

                    integer(kind=8) D.2034;

                    integer(kind=8) D.2033;

                    integer(kind=8) D.2032;

                    integer(kind=8) S.30;



                    D.2032 = S.29 * 2 + -3;

                    D.2033 = S.29 * 2 + -3;

                    D.2034 = S.29 * 2 + -3;

                    S.30 = 1;

                    while (1)

                      {

                        if (S.30 > 2) goto L.11;

                        split_vs (&strar[S.30 + D.2032], &wrdar[S.30 + D.2033],

&D.2029, &separ[S.30 + D.2034], 0B);

                        S.30 = S.30 + 1;

                      }

                    L.11:;

                  }

                  S.29 = S.29 + 1;

                }

              L.12:;

            }

          }

        }

      else

        {

          i = 1;

          if (i <= 2)

            {

              while (1)

                {

                  {

                    logical(kind=4) D.2049;



                    j = 1;

                    if (j <= 2)

                      {

                        while (1)

                          {

                            {

                              logical(kind=4) D.2048;



                              {

                                void * restrict D.2046;

                                integer(kind=4) D.2045;

                                character(kind=1)[1:MAX_EXPR <D.2043, 0>] *

pstr.31;

                                integer(kind=4) D.2043;

                                struct varying_string * D.2042;



                                D.2042 = &set;

                                D.2043 = len_ (D.2042);

                                D.2045 = MAX_EXPR <D.2043, 0> * 64;

                                D.2046 = (void * restrict) __builtin_malloc

(MAX_EXPR <(unsigned long) D.2045, 1>);

                                pstr.31 = (character(kind=1)[1:MAX_EXPR

<D.2043, 0>] *) D.2046;

                                char_auto (pstr.31, MAX_EXPR <D.2043, 0>,

D.2042);

                                split_ch (&strar[((integer(kind=8)) j * 2 +

(integer(kind=8)) i) + -3], &wrdar[((integer(kind=8)) j * 2 + (integer(kind=8))

i) + -3], pstr.31, &separ[((integer(kind=8)) j * 2 + (integer(kind=8)) i) +

-3], 0B, MAX_EXPR <D.2043, 0>);

                                {

                                  void * D.2047;



                                  D.2047 = (void *) pstr.31;

                                  if (D.2047 != 0B)

                                    {

                                      __builtin_free (D.2047);

                                    }

                                }

                              }

                              L.15:;

                              D.2048 = j == 2;

                              j = j + 1;

                              if (D.2048) goto L.16;

                            }

                          }

                      }

                    L.16:;

                    L.13:;

                    D.2049 = i == 2;

                    i = i + 1;

                    if (D.2049) goto L.14;

                  }

                }

            }

          L.14:;

        }

    }

  L.8:;

}

Reply via email to