public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jvdelisle at gcc dot gnu.org" <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: Tue, 16 Nov 2010 07:42:00 -0000	[thread overview]
Message-ID: <bug-46339-4-PSheJi2MF1@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 #15 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-11-16 06:42:08 UTC ---
With a slight modification to the patch in Comment #10, gfortran now gives:

@@ -1041,7 +1041,7 @@
 tree
 gfc_get_symbol_decl (gfc_symbol * sym)
 {
-  tree decl;
+  tree decl = NULL;
   tree length = NULL_TREE;
   tree attributes;
   int byref;


$ ./a.out 
 *******************
 myA      =           1 a           2 b           3 c           4 d
 -------------------
 Inside test_sub:
   sorb%i%j =           1           2           3           4
   ipn%i%j  =           1           2           3           4
   ipn      =           1           2           3           4
 Inside main:
        ptr =           1          97           2          98
    myA%i%j =           1           2           3           4
 Inside test_sub2:
   sorb%i%j =           1           2           3           4
  local_ptr =           1           2           3           4

This is much closer. Just need to get the returned pointer right.

Test case is:

module test
  implicit none
  type b
    integer :: j
    character :: c
  end type b
  type a
    type(b), dimension(4) :: i
  end type a
contains
  subroutine test_sub(sorb,ipn)
    type(a), intent(in), target :: sorb
    integer, dimension(:), pointer :: ipn
    ipn=>sorb%i%j
    print *, "Inside test_sub:"
    print *, "  sorb%i%j =", sorb%i%j
    print *, "  ipn%i%j  =", ipn(:)
    print *, "  ipn      =", ipn
  end subroutine test_sub
  subroutine test_sub2(sorb)
    type(a), intent(in), target :: sorb
    integer, dimension(:), pointer :: local_ptr
    local_ptr=>sorb%i%j
    print *, "Inside test_sub2:"
    print *, "  sorb%i%j =", sorb%i%j
    print *, " local_ptr =", local_ptr
    if (any(local_ptr /= (/ 1,2,3,4 /))) call abort()
  end subroutine test_sub2
end module test

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' /)
  print *, "*******************"
  print *, "myA      =", myA
  print *, "-------------------"
  call test_sub(myA,ptr)
  print *, "Inside main:"
  print *, "       ptr =", ptr
  print *, "   myA%i%j =", myA%i%j
  !if (any(ptr /= (/ 1,2,3,4 /))) call abort()
  call test_sub2(myA)
end program main


  parent reply	other threads:[~2010-11-16  6:42 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 [this message]
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
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-PSheJi2MF1@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).