From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19669 invoked by alias); 12 Oct 2012 19:22:03 -0000 Received: (qmail 19643 invoked by uid 48); 12 Oct 2012 19:21:49 -0000 From: "quantheory at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/54917] New: transfer on polymorphic variable causes ICE (gfc_target_expr_size) Date: Fri, 12 Oct 2012 19:22:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: quantheory at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-10/txt/msg01231.txt.bz2 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: unassigned@gcc.gnu.org ReportedBy: quantheory@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