public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "damian at sourceryinstitute dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/66321] New: [4.9.2/5.1.0/6.0.0] errors allocating allocatable array component of pointer object component Date: Thu, 28 May 2015 00:05:00 -0000 [thread overview] Message-ID: <bug-66321-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66321 Bug ID: 66321 Summary: [4.9.2/5.1.0/6.0.0] errors allocating allocatable array component of pointer object component Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: damian at sourceryinstitute dot org Target Milestone: --- Possibly this bug is related to Bug 56471 (which is oustanding) and/or Bug 65841 (which has been fixed). The code listing below demonstrates what appears to be a rejection of valid code in gfortran versions 4.9.2, 5.1.0, and 6.0.0. After commenting the offending line, the resulting code generates a runtime segmentation fault when the subsequent line attempts automatically allocate the variable whose explicit source allocation was rejected in the original code. Both versions of the code compile and execute cleanly with the Cray, Portland Group, NAG, and Intel compilers. Damian localhost:seg-fault rouson$ cat compile-time-error.f90 type Bar integer, allocatable :: a(:) end type type Foo type (bar), pointer :: b end type type(Foo) f allocate(f%b) allocate(f%b%a,source=[3]) ! Compile-time error f%b%a = [3] ! Run-time seg fault end localhost:seg-fault rouson$ gfortran compile-time-error.f90 compile-time-error.f90:9:9: allocate(f%b%a,source=[3]) ! Compile-time error 1 Error: Array specification required in ALLOCATE statement at (1) localhost:seg-fault rouson$ sed 's/allocate(f%b%a/!allocate(f%b%a/' < compile-time-error.f90 > run-time-error.f90 localhost:seg-fault rouson$ gfortran run-time-error.f90 localhost:seg-fault rouson$ ./a.out Program received signal SIGSEGV: Segmentation fault - invalid memory reference. Backtrace for this error: #0 0x10ad0ab26 #1 0x10ad0a0c3 #2 0x7fff8a317f19 #3 0x10ad03e5e #4 0x10ad03ea0 Segmentation fault: 11 localhost:seg-fault rouson$ gfortran --version GNU Fortran (MacPorts gcc6 6-20150510_0) 6.0.0 20150510 (experimental) Copyright (C) 2015 Free Software Foundation, Inc.
next reply other threads:[~2015-05-28 0:05 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-05-28 0:05 damian at sourceryinstitute dot org [this message] 2015-05-28 7:02 ` [Bug fortran/66321] " vehre at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-66321-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).