Erik Edelmann's patch for PR fortran/18197 introduced a regression. 

a) The following test case does not compile with gfortran >= Revision 108555

--- cut here ---
% cat > foo.h <<EOF
interface
  function foo() result (dresult)
    real :: dresult
  end function foo
end interface
EOF

% cat > regression.f90 <<EOF
module regression

contains

  subroutine helper(foo)
    include "foo.h"
  end subroutine helper

  subroutine master(foo)
    include "foo.h"
    call slave(foo, helper)
  end subroutine master

  subroutine slave(foo, subslave)
    include "foo.h"
    interface
      subroutine subslave(foo)
        include "foo.h"
      end subroutine subslave
    end interface
    call subslave(foo)
  end subroutine slave

end module regression
EOF
--- cut here ---

instead gfortran gives:

% gfortran -v -c regression.f90
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../../src/gcc/configure --enable-shared
--prefix=/home/[...]/20060201 --enable-languages=c,c++,fortran --enable-threads
--enable-__cxa_atexit
Thread model: posix
gcc version 4.2.0 20060201 (experimental)
 /home/[...]/20060201/bin/../libexec/gcc/i686-pc-linux-gnu/4.2.0/f951
regression.f90 -quiet -dumpbase regression.f90 -mtune=generic -auxbase
regression -version -o /tmp/ccNFDNgH.s
GNU F95 version 4.2.0 20060201 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.2.0 20060201 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096

 In file regression.f90:11

    call slave(foo, helper)
                  1
Error: Type/rank mismatch in argument 'subslave' at (1)

b) Swapping the order of subroutines helper and master in above testcase
resolves the regression, gfortran compiles smoothly. (The complexity of the
code I actually tried to compile is higher and I did not find a suitable
permutation of subroutines yet.)

c) Compiling the current revision (110474) having reverted only Erik's patch:

--- cut here ---
% cat > undopatch18197 <<EOF
140a141,151
>           else
>             {
>                /* Set the type of the RESULT, then copy.  */
>               if (sym->result->ts.type == BT_UNKNOWN)
>                 gfc_set_default_type (sym->result, 1, sym->result->ns);
>
>               sym->ts = sym->result->ts;
>               if (sym->as == NULL)
>                 sym->as = gfc_copy_array_spec (sym->result->as);
>             }
>
EOF

% patch gcc/fortran/resolve.c < undopatch18197
% ./configure [....]; make bootstrap install
--- cut here ---

the above testcase compiles smoothly again - while reopening the error reported
in bug 18197 (and causing another error in my already mentioned code I could
not reduce to a small testcase so far.)


-- 
           Summary: 4.1 regression introduced with patch for bug 18197
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sven dot buijssen at math dot uni-dortmund dot de
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to