From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6641 invoked by alias); 6 Mar 2014 21:24:48 -0000 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 Received: (qmail 6618 invoked by uid 48); 6 Mar 2014 21:24:44 -0000 From: "dave.allured at noaa dot gov" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/60450] New: ICE with SHAPE intrinsic Date: Thu, 06 Mar 2014 21:24: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-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dave.allured at noaa dot gov X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-03/txt/msg00534.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60450 Bug ID: 60450 Summary: ICE with SHAPE intrinsic Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: dave.allured at noaa dot gov Created attachment 32293 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32293&action=edit Backtrace and crash dump for shape-bug.2.f90 linux64:~/temp/shape-bug 230> cat shape-bug.2.f90 program shape_bug integer dims(2) real, allocatable :: x(:,:,:) allocate (x(3,5,2)) x = 99.0 dims = shape (sum (x, 2) / 10.0) print *, 'shape = ', dims end program shape_bug linux64:~/temp/shape-bug 231> gfortran -Wall -Wextra shape-bug.2.f90 *** glibc detected *** /usr/local/gcc-4.8/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/f951: double free or corruption (out): 0x0000000001da17d0 *** ======= Backtrace: ========= /lib64/libc.so.6[0x31fd876166] /lib64/libc.so.6[0x31fd878c93] /usr/local/gcc-4.8/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/f951(_Z15gfc_clear_shapePA1_12__mpz_structi+0x1f)[0x4f93af] /usr/local/gcc-4.8/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/f951(_Z18gfc_simplify_shapeP8gfc_exprS0_+0x202)[0x563962] /usr/local/gcc-4.8/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/f951[0x505552] /usr/local/gcc-4.8/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/f951(_Z28gfc_intrinsic_func_interfaceP8gfc_expri+0x1c0)[0x5069c0] /usr/local/gcc-4.8/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/f951(_Z16gfc_resolve_exprP8gfc_expr+0x1968)[0x54b828] See attachment for full crash dump. There are obvious workarounds by decomposing the nested expression into multiple statements. Here is compiler and platform identification: linux64:~/temp/shape-bug 240> gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/usr/local/gcc-4.8/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /usr/local/src/gcc-4.8.2/configure --with-gmp=/usr/local/gcc-4.8 --with-mpfr=/usr/local/gcc-4.8 --with-mpc=/usr/local/gcc-4.8 --prefix=/usr/local/gcc-4.8 --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-lto --enable-languages=c,c++,fortran --disable-multilib --disable-bootstrap --disable-install-libiberty --with-system-zlib Thread model: posix gcc version 4.8.2 (GCC) linux64:~/temp/shape-bug 241> uname -a Linux linux64.psd.esrl.noaa.gov 2.6.32-431.5.1.el6.x86_64 #1 SMP Fri Jan 10 14:46:43 EST 2014 x86_64 GNU/Linux ---------------------------------------------------------------------- This also fails with the same gfortran version 4.8.2 on Mac OS: mac56:/home/dallured/temp/shape-bug 7> gfortran -Wall -Wextra shape-bug.2.f90 f951(58275) malloc: *** error for object 0x141618cd0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug f951: internal compiler error: Abort trap: 6 gfortran: internal compiler error: Abort trap: 6 (program f951) Abort Note: On the Mac version, no lengthy crash log, I don't know why. mac56:/home/dallured/temp/shape-bug 8> gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.8.2/lto-wrapper Target: x86_64-apple-darwin12 Configured with: /opt/local/var/macports/build/_opt_mports_dports_lang_gcc48/gcc48/work/gcc-4.8.2/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java --libdir=/opt/local/lib/gcc48 --includedir=/opt/local/include/gcc48 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.8 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.8 --with-gxx-include-dir=/opt/local/include/gcc48/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --with-pkgversion='MacPorts gcc48 4.8.2_0' Thread model: posix gcc version 4.8.2 (MacPorts gcc48 4.8.2_0) Thanks for looking into this.