public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sven dot buijssen at math dot uni-dortmund dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/15809] ICE Using Pointer Functions
Date: Sun, 23 Oct 2005 13:34:00 -0000	[thread overview]
Message-ID: <20051023133408.5300.qmail@sourceware.org> (raw)
In-Reply-To: <bug-15809-7776@http.gcc.gnu.org/bugzilla/>



------- Comment #13 from sven dot buijssen at math dot uni-dortmund dot de  2005-10-23 13:34 -------
In the meantime with gfortran 4.0.2 and the latest CVS version of gfortran (GNU
F95 version 4.1.0 20051023 (experimental)) again both Tobi's and Erik's
testcases give ICEs, both different ones:

# Tobi's testcase
$ cat bug7.f90 
SUBROUTINE A(p,LEN)
    CHARACTER(LEN=LEN), DIMENSION(:), POINTER :: p
    IF ( .NOT. ASSOCIATED(p) ) THEN
    END IF
END SUBROUTINE A
$ gfortran bug7.f90 
bug7.f90: In function 'a':
bug7.f90:3: internal compiler error: in gfc_trans_deferred_array, at
fortran/trans-array.c:4163

# Erik's testcase
$ cat bug7a.f90 
SUBROUTINE A(p,LEN)
    CHARACTER(LEN=LEN), DIMENSION(:), POINTER :: p
    IF ( .NOT. ASSOCIATED(p) ) THEN
        allocate(p(1))
    END IF
END SUBROUTINE A
$ gfortran bug7a.f90 
bug7a.f90: In function 'a':
bug7a.f90:1: internal compiler error: Segmentation fault


Both testcases, however, compile smoothly when replacing CHARACTER(LEN=LEN) by
something fixed, e.g. CHARACTER(LEN=5). So, assigning a fixed length is a
possible workaround for those that are affected by this bug, like I am.

Investigating this bug further one finds:
1) Tobi's testcase with assumed-length character, CHARACTER(LEN=*), compiles
smoothly as well, while Erik's testcase with CHARACTER(LEN=*) gives again
bug7a.f90: In function 'a':
bug7a.f90:1: internal compiler error: Segmentation fault

2) The problem seems to be that accessing a member of the array p, e.g. via 
    print *, p(1)
   or via 'allocate' as in Erik's test case, causes an ICE if and if only an
assumed-length character is used. CHARACTER(LEN=<some number>) works.

3) Fixing this bug will probably also fix the ICE for the following invalid (!)
code 
$ cat bug7c.f90 
  function foo()
    character(len=*),dimension(:),pointer :: foo
    allocate(foo(1))
  end function
$ gfortran -c bug7c.f90
bug3.f90: In function 'foo':
bug3.f90:1: internal compiler error: Segmentation fault

while it simply gives errors with ifort 9.0 20050809
> fortcom: Error: bug3.f90, line 1: A CHARACTER function name must not be declared with an asterisk type-param-value (i.e., (LEN=*)) if the function is array-valued. 
and g95 (G95 (GCC 4.0.1 (g95!) Oct 16 2005))
> Error: POINTER valued function 'foo' at (1) cannot return an assumed-length character (*)

As previously, this problem only occurs if assumed-length character is used
instead of a fixed length.

I hope this information will help tracing the error.


For sake of completeness:
$ gfortran -v                    
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcccvs/configure --enable-shared
--prefix=/usr/local/gcc-4.0.x-cvs --enable-languages=c,c++,fortran
--enable-threads --enable-__cxa_atexit
Thread model: posix
gcc version 4.1.0 20051023 (experimental)

$ gfortran-4.0.2 -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.0.2/configure --enable-shared
--prefix=/usr/local/gcc-4.0.2 --enable-languages=c,c++,f95 --enable-threads
--enable-__cxa_atexit
Thread model: posix
gcc version 4.0.2

Environment:
System: Linux stingray 2.6.8-24.18-default #1 Fri Aug 19 11:56:28 UTC 2005 i686
unknown unknown GNU/Linux
Architecture: i686
glibc 2.3.4
SuSE 9.2
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu


-- 

sven dot buijssen at math dot uni-dortmund dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sven dot buijssen at math
                   |                            |dot uni-dortmund dot de
Bug 15809 depends on bug 15326, which changed state.

Bug 15326 Summary: [4.0 only] ICE with assumed length character strings
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15326

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

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


       reply	other threads:[~2005-10-23 13:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-15809-7776@http.gcc.gnu.org/bugzilla/>
2005-10-23 13:34 ` sven dot buijssen at math dot uni-dortmund dot de [this message]
2005-11-21 15:53 ` pault at gcc dot gnu dot org
2005-11-21 18:06 ` sven dot buijssen at math dot uni-dortmund dot de
2005-11-21 18:08 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2005-11-22 20:16 ` pault at gcc dot gnu dot org
2005-11-23 14:26 ` paul dot richard dot thomas at cea dot fr
2005-11-30 17:26 ` pault at gcc dot gnu dot org
2005-11-30 19:26 ` pault at gcc dot gnu dot org
2005-12-05 11:14 ` jakub at gcc dot gnu dot org
2005-12-07  6:20 ` pault at gcc dot gnu dot org
2005-12-12 20:10 ` pinskia at gcc dot gnu dot org
2004-06-03 20:12 [Bug fortran/15809] New: " giese025 at tc dot umn dot edu
2004-06-03 20:13 ` [Bug fortran/15809] " giese025 at tc dot umn dot edu
2004-06-03 20:21 ` pinskia at gcc dot gnu dot org
2004-07-11 17:10 ` tobi at gcc dot gnu dot org
2004-08-25 22:10 ` tobi at gcc dot gnu dot org
2004-09-22  7:48 ` c dot lemmen at fz-juelich dot de
2004-12-14 17:53 ` pinskia at gcc dot gnu dot org
2005-04-03  2:25 ` szalai at mit dot edu
2005-06-05 22:44 ` pault at gcc dot gnu dot org
2005-08-30 20:44 ` erik dot edelmann at iki dot fi
2005-08-31 19:39 ` tobi at gcc dot gnu dot org
2005-09-02 11:34 ` tobi at gcc dot gnu dot org
2005-09-02 11:58 ` erik dot edelmann at iki dot fi
2005-09-02 15:39 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2005-09-06 21:10 ` erik dot edelmann at iki dot fi
2005-09-08 18:51 ` rsandifo at gcc dot gnu dot org
2005-09-18 19:53 ` tkoenig at gcc dot gnu dot 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=20051023133408.5300.qmail@sourceware.org \
    --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).