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



--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-12-07 
21:13:57 UTC ---

Created attachment 28898

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

Test case (still depends on the iso_varying_string module)



Slightly reduced test case - still needs the iso_varying_string module.

Compiling with 4.4/4.8 and 4.8/4.4 shows that the attached file miscompiled

while the big iso_varying_string module is correctly handled.



If one compares the dump between 4.4 and 4.8 for the second (the array) SPLIT

call, one finds for 4.4 and 4.8, respectively:



split_ch (&strar[S.14 + D.1624], &wrdar[S.14 + D.1625], D.1621, &separ[S.14 +

D.1626], 0B, MAX_EXPR <D.1616, 0>);



split_ch (&strar[S.14 + D.1624], &wrdar[S.14 + D.1625], &D.1621, &separ[S.14 +

D.1626], 0B, MAX_EXPR <D.1616, 0>);





Note the "&" before D.1621. The latter is:



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

  D.1964 = &set;

  D.1619 = __builtin_malloc (....)

  char_auto (pstr.12, MAX_EXPR <D.1616, 0>, D.1964);

  pstr.12 = (character(kind=1)[1:MAX_EXPR <D.1616, 0>] *) D.1619;





The called function is defined as:



  elemental subroutine split_CH (string, word, set, separator, back)

    type(varying_string), intent(inout)         :: string

    type(varying_string), intent(out)           :: word

    character(LEN=*), intent(in)                :: set

    type(varying_string), intent(out), optional :: separator

    logical, intent(in), optional               :: back

Reply via email to