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



             Bug #: 56477

           Summary: ICE on invalid with pointer assignment to function

                    result

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: fortran

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: abenso...@gmail.com





The following causes an ICE with gfortran 4.8.0 r196316:



module s

contains

  function so()

    implicit none

    integer, target  :: so

    integer, pointer :: sp

    sp => so

    return

  end function So

end module s



$ gfortran -v

Using built-in specs.

COLLECT_GCC=gfortran

COLLECT_LTO_WRAPPER=/home/abenson/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper

Target: x86_64-unknown-linux-gnu

Configured with: ../gcc-trunk/configure --prefix=/home/abenson

--enable-languages=c,c++,fortran --disable-multilib --with-gmp=/home/abenson

Thread model: posix

gcc version 4.8.0 20130227 (experimental) (GCC) 



$ gfortran -c -o ICEtest.o ICEtest.F90 -Wall

f951: internal compiler error: Segmentation fault

0x92f79f crash_signal

        ../../gcc-trunk/gcc/toplev.c:332

0x4fdbf2 gfc_check_pointer_assign(gfc_expr*, gfc_expr*)

        ../../gcc-trunk/gcc/fortran/expr.c:3734

0x5555d6 resolve_code

        ../../gcc-trunk/gcc/fortran/resolve.c:10261

0x557c5e resolve_codes

        ../../gcc-trunk/gcc/fortran/resolve.c:14972

0x557b67 resolve_codes

        ../../gcc-trunk/gcc/fortran/resolve.c:14958

0x548aa2 gfc_resolve

        ../../gcc-trunk/gcc/fortran/resolve.c:15000

0x53d186 gfc_parse_file()

        ../../gcc-trunk/gcc/fortran/parse.c:4608

0x579415 gfc_be_parse_file

        ../../gcc-trunk/gcc/fortran/f95-lang.c:189

Please submit a full bug report,

with preprocessed source if appropriate.

Please include the complete backtrace with any bug report.

See <http://gcc.gnu.org/bugs.html> for instructions.





The "-Wall" is important - without the code compiles without complaint.



I tagged this as invalid(?) because I don't think that giving the function

return value the TARGET attribute makes sense, although I couldn't find

anything that clearly says it's not allowed.

Reply via email to