public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "david.sagan at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/46339] [4.3/4.4/4.5/4.6 Regression] ICE (segfault) in gfc_trans_pointer_assignment
Date: Fri, 19 Nov 2010 21:33:00 -0000	[thread overview]
Message-ID: <bug-46339-4-80Y3PPwFDi@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-46339-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #23 from david.sagan at gmail dot com 2010-11-19 21:24:01 UTC ---
(In reply to comment #22)
> > > Is there something invalid here?
> >
> > Yes.  You need to allocate ptr unless you have
> > pault's [re-]allocate on assignment patch.
> 
> Even with Paul's patch it does not work.

It works for me. The following two variants give the correct result (and this
is without any patching):

program main
 use test
 implicit none
 type(a), target :: myA
 integer, dimension(:), pointer :: ptr
 myA%i(1:4)%j = (/ 1, 2, 3, 4 /)
 myA%i(1:4)%c = (/ 'a', 'b', 'c', 'd' /)
 allocate (ptr(4))
 ptr =  myA%i%j
 print *, "       ptr =", ptr
 print *, "   myA%i%j =", myA%i%j
end program main

program main
 use test
 implicit none
 type(a), target :: myA
 integer, dimension(:), pointer :: ptr
 myA%i(1:4)%j = (/ 1, 2, 3, 4 /)
 myA%i(1:4)%c = (/ 'a', 'b', 'c', 'd' /)
 ptr => myA%i%j
 print *, "       ptr =", ptr
 print *, "   myA%i%j =", myA%i%j
end program main


Both give:
        ptr =           1           2           3           4
    myA%i%j =           1           2           3           4


  parent reply	other threads:[~2010-11-19 21:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-07  2:23 [Bug fortran/46339] New: Internal compiler error david.sagan at gmail dot com
2010-11-07  8:24 ` [Bug fortran/46339] [4.3/4.4/4.5/4.6 Regression] ICE (segfault) in gfc_trans_pointer_assignment burnus at gcc dot gnu.org
2010-11-13  7:15 ` jvdelisle at gcc dot gnu.org
2010-11-13  9:31 ` jvdelisle at gcc dot gnu.org
2010-11-13 19:10 ` burnus at gcc dot gnu.org
2010-11-14 18:14 ` jvdelisle at gcc dot gnu.org
2010-11-14 18:51 ` burnus at gcc dot gnu.org
2010-11-14 18:57 ` jvdelisle at gcc dot gnu.org
2010-11-15  6:53 ` jvdelisle at gcc dot gnu.org
2010-11-15  6:58 ` jvdelisle at gcc dot gnu.org
2010-11-15  8:37 ` jvdelisle at gcc dot gnu.org
2010-11-15 10:37 ` dominiq at lps dot ens.fr
2010-11-16  3:45 ` jvdelisle at gcc dot gnu.org
2010-11-16  4:59 ` jvdelisle at gcc dot gnu.org
2010-11-16  6:42 ` jvdelisle at gcc dot gnu.org
2010-11-16  7:42 ` jvdelisle at gcc dot gnu.org
2010-11-16  8:18 ` jvdelisle at gcc dot gnu.org
2010-11-16  8:23 ` burnus at gcc dot gnu.org
2010-11-16 15:11 ` paul.richard.thomas at gmail dot com
2010-11-19 18:02 ` jvdelisle at gcc dot gnu.org
2010-11-19 20:49 ` david.sagan at gmail dot com
2010-11-19 20:54 ` kargl at gcc dot gnu.org
2010-11-19 21:24 ` dominiq at lps dot ens.fr
2010-11-19 21:33 ` sgk at troutmask dot apl.washington.edu
2010-11-19 21:33 ` david.sagan at gmail dot com [this message]
2010-11-19 22:10 ` dominiq at lps dot ens.fr
2010-11-21  7:52 ` pault at gcc dot gnu.org
2010-11-25 20:16 ` [Bug fortran/46339] " jvdelisle 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-46339-4-80Y3PPwFDi@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: link
Be 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).