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



             Bug #: 54917

           Summary: transfer on polymorphic variable causes ICE

                    (gfc_target_expr_size)

    Classification: Unclassified

           Product: gcc

           Version: 4.7.3

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: fortran

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

        ReportedBy: quanthe...@gmail.com





Created attachment 28436

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

Short program that causes the bug



When compiling a routine that uses transfer on a polymorphic variable, the

following command fails:



gfortran -c -Wsurprising test_module.F90



The error message is:







test_module.F90:18.22:



end module test_module

                      1

Internal Error at (1):

Invalid expression in gfc_target_expr_size.







This error does not occur if -Wsurprising is off and the polymorphic variable

is the "source". It does occur if the polymorphic variable is the "mold", even

with no warnings on.





Obviously, you would rarely-or-never want to actually do such a transfer, but I

did notice this problem because I have been using the following macro to turn

off warnings about unused arguments:



#define UNUSED_VAR(arg) if (.false.) write(*,*) transfer(arg,1)



A bit hack-ish, but gets the job done in impure routines. In any case, even if

gfortran rejects this, getting a specific error message rather than an internal

error would be nice.





I'm in a somewhat limited environment right now, so I can't tell for sure

whether this is an old problem or a regression. This has happened with one of

the 4.7.3 unofficial prerelease builds:



gcc-4.7 -v

Using built-in specs.

COLLECT_GCC=gcc-4.7

COLLECT_LTO_WRAPPER=/home/santos/gcc-4.7/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.3/lto-wrapper

Target: x86_64-unknown-linux-gnu

Configured with: ../gcc-4.7-source/gcc-4.7-20120929/configure

--enable-languages=c,c++,fortran --enable-checking=release --disable-bootstrap

--disable-libmudflap --enable-libgomp --enable-lto --enable-gold

--with-plugin-ld=/usr/bin/gold --prefix=/usr/local/gcc-4.7

Thread model: posix

Reply via email to