public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "thfanning at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/64555] New: Fail to compile array pointer to derived-type components Date: Sat, 10 Jan 2015 15:34:00 -0000 [thread overview] Message-ID: <bug-64555-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64555 Bug ID: 64555 Summary: Fail to compile array pointer to derived-type components Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: blocker Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: thfanning at gmail dot com When assigning an array pointer to a scalar component of an array of a derived type, compilation fails with undefined "span.n". Given the following code, test.f90: module mod_abc type a integer :: item end type type(a), pointer :: array(:) integer, pointer :: item(:) => NULL() contains subroutine init(n) integer :: n allocate(array(n)) item => array%item ! problem occurs here end subroutine end module program test use mod_abc integer, parameter :: n = 10 integer :: i print *, "Hello, World!" call init(n) do i = 1,n array(i)%item = i enddo do i = 1,n print "(i6,': ',i6)", i, item(i) enddo end program On an Intel architecture... gfortran -m32 test.f90: /var/folders/l9/qcd__g594cv5qn_nc1nwyvvrd6xjn9/T//ccmNxERg.s:209:non-relocatable subtraction expression, "_span.0" minus "L2$pb" /var/folders/l9/qcd__g594cv5qn_nc1nwyvvrd6xjn9/T//ccmNxERg.s:209:symbol: "_span.0" can't be undefined in a subtraction expression /var/folders/l9/qcd__g594cv5qn_nc1nwyvvrd6xjn9/T//ccmNxERg.s:93:non-relocatable subtraction expression, "_span.0" minus "L1$pb" /var/folders/l9/qcd__g594cv5qn_nc1nwyvvrd6xjn9/T//ccmNxERg.s:93:symbol: "_span.0" can't be undefined in a subtraction expression gfortran -m64 test.f90: Undefined symbols for architecture x86_64: "_span.0", referenced from: ___mod_abc_MOD_init in ccyXTbtG.o _MAIN__ in ccyXTbtG.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status On an embedded ARM architecture: gfortran test.f90: /tmp/cccNTntp.o: In function `__mod_abc_MOD_init': span.f90:(.text+0x1b4): undefined reference to `span.0' /tmp/cccNTntp.o: In function `MAIN__': span.f90:(.text+0x38c): undefined reference to `span.0' collect2: ld returned 1 exit status HOWEVER, if optimization is used on the ARM, then the code compiles correctly: gfortran -O test.f90 ./a.out Hello, World! 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10
next reply other threads:[~2015-01-10 15:34 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-01-10 15:34 thfanning at gmail dot com [this message] 2015-01-10 15:56 ` [Bug fortran/64555] " thfanning at gmail dot com 2015-01-10 17:06 ` dominiq at lps dot ens.fr 2015-01-10 17:08 ` dominiq at lps dot ens.fr 2015-08-30 10:26 ` dominiq at lps dot ens.fr
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-64555-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).