public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/29396]  New: segfault with character pointer association
@ 2006-10-08 21:46 fxcoudert at gcc dot gnu dot org
  2006-10-08 21:46 ` [Bug fortran/29396] " fxcoudert at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-10-08 21:46 UTC (permalink / raw)
  To: gcc-bugs

$ cat a3.f90
  CHARACTER(LEN=2), DIMENSION(:), POINTER :: a 
  CHARACTER(LEN=4), DIMENSION(3), TARGET :: b 
  b=(/"bbbb","bbbb","bbbb"/) 
  a=>b(:)(2:3) 
  a="aa" 
  IF (ANY(b.NE.(/"baab","baab","baab"/))) CALL ABORT() 
  END 
$ gfortran a3.f90 
a3.f90:0: internal compiler error: Segmentation fault


gdb backtrace is:

Program received signal SIGSEGV, Segmentation fault.
0x00000000004179b2 in gfc_check_pointer_assign (lvalue=0xce3ae0, 
    rvalue=0xce3de0) at ../../trunk/gcc/fortran/expr.c:2330
2330      if (lvalue->ts.type == BT_CHARACTER
(gdb) where
#0  0x00000000004179b2 in gfc_check_pointer_assign (lvalue=0xce3ae0, 
    rvalue=0xce3de0) at ../../trunk/gcc/fortran/expr.c:2330
#1  0x000000000044a349 in resolve_code (code=0xce42c0, ns=0xce2380)
    at ../../trunk/gcc/fortran/resolve.c:4967
#2  0x000000000044b765 in gfc_resolve (ns=0xce2380)
    at ../../trunk/gcc/fortran/resolve.c:6919
#3  0x0000000000440a68 in gfc_parse_file ()
    at ../../trunk/gcc/fortran/parse.c:3212

2330      if (lvalue->ts.type == BT_CHARACTER
2331            && lvalue->ts.cl->length && rvalue->ts.cl->length
2332            && abs (gfc_dep_compare_expr (lvalue->ts.cl->length,
2333                                          rvalue->ts.cl->length)) == 1)

(gdb) p lvalue->ts
$1 = {type = BT_CHARACTER, kind = 1, derived = 0x0, cl = 0xcb0800}
(gdb) p rvalue->ts
$2 = {type = BT_CHARACTER, kind = 1, derived = 0x0, cl = 0x0}

So rvalue->ts.cl->length should not be referenced.


-- 
           Summary: segfault with character pointer association
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29396] segfault with character pointer association
  2006-10-08 21:46 [Bug fortran/29396] New: segfault with character pointer association fxcoudert at gcc dot gnu dot org
@ 2006-10-08 21:46 ` fxcoudert at gcc dot gnu dot org
  2007-01-28 22:15 ` jvdelisle at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-10-08 21:46 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-10-08 21:46:03
               date|                            |


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29396] segfault with character pointer association
  2006-10-08 21:46 [Bug fortran/29396] New: segfault with character pointer association fxcoudert at gcc dot gnu dot org
  2006-10-08 21:46 ` [Bug fortran/29396] " fxcoudert at gcc dot gnu dot org
@ 2007-01-28 22:15 ` jvdelisle at gcc dot gnu dot org
  2007-01-30 23:24 ` jvdelisle at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-01-28 22:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jvdelisle at gcc dot gnu dot org  2007-01-28 22:15 -------
In the spirit of Paul's suggestion.  I will try this one.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jvdelisle at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-10-08 21:46:03         |2007-01-28 22:15:31
               date|                            |


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29396] segfault with character pointer association
  2006-10-08 21:46 [Bug fortran/29396] New: segfault with character pointer association fxcoudert at gcc dot gnu dot org
  2006-10-08 21:46 ` [Bug fortran/29396] " fxcoudert at gcc dot gnu dot org
  2007-01-28 22:15 ` jvdelisle at gcc dot gnu dot org
@ 2007-01-30 23:24 ` jvdelisle at gcc dot gnu dot org
  2007-03-16 15:14 ` fxcoudert at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-01-30 23:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jvdelisle at gcc dot gnu dot org  2007-01-30 23:24 -------
Un-assigning myself.  Don't have time to delve into the deeper problem here
which may require changes to array descriptors. After brief exchange with Paul
off list.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|jvdelisle at gcc dot gnu dot|unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29396] segfault with character pointer association
  2006-10-08 21:46 [Bug fortran/29396] New: segfault with character pointer association fxcoudert at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-01-30 23:24 ` jvdelisle at gcc dot gnu dot org
@ 2007-03-16 15:14 ` fxcoudert at gcc dot gnu dot org
  2007-03-16 15:16 ` fxcoudert at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-03-16 15:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2007-03-16 15:13 -------
*** Bug 31220 has been marked as a duplicate of this bug. ***


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jv244 at cam dot ac dot uk


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29396] segfault with character pointer association
  2006-10-08 21:46 [Bug fortran/29396] New: segfault with character pointer association fxcoudert at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-03-16 15:14 ` fxcoudert at gcc dot gnu dot org
@ 2007-03-16 15:16 ` fxcoudert at gcc dot gnu dot org
  2007-03-16 19:30 ` fxcoudert at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-03-16 15:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2007-03-16 15:15 -------
Joost filed PR31220, which is a duplicate of this one, but contains an
interesting testcase (compile & run) to check and add to the testsuite when
we're done with this bug:

CHARACTER(LEN=4), POINTER :: b
CHARACTER(LEN=10) :: r
b=>F1(1,r)
b="1111"
b=>F1(2,r)
b="2222"
b=>F1(3,r)
b="3333"
IF (r.NE."12222-----") CALL ABORT()
CONTAINS
FUNCTION F1(I,r) result(b)
INTEGER :: I
CHARACTER(LEN=10), TARGET, SAVE :: a="----------"
CHARACTER(LEN=10) :: r
CHARACTER(LEN=4), POINTER :: b
r=a
b=>a(I:I+3)
END FUNCTION
END


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.2.0 4.3.0
   Last reconfirmed|2007-01-28 22:15:31         |2007-03-16 15:15:54
               date|                            |


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29396] segfault with character pointer association
  2006-10-08 21:46 [Bug fortran/29396] New: segfault with character pointer association fxcoudert at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-03-16 15:16 ` fxcoudert at gcc dot gnu dot org
@ 2007-03-16 19:30 ` fxcoudert at gcc dot gnu dot org
  2007-05-05 22:55 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-03-16 19:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from fxcoudert at gcc dot gnu dot org  2007-03-16 19:30 -------
*** Bug 31212 has been marked as a duplicate of this bug. ***


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29396] segfault with character pointer association
  2006-10-08 21:46 [Bug fortran/29396] New: segfault with character pointer association fxcoudert at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-03-16 19:30 ` fxcoudert at gcc dot gnu dot org
@ 2007-05-05 22:55 ` jvdelisle at gcc dot gnu dot org
  2007-09-03 11:46 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-05 22:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2007-05-05 23:54 -------
The test case in comment #4 appears to be working fine on my system here.  I
suspect it was not a duplicate after all.


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29396] segfault with character pointer association
  2006-10-08 21:46 [Bug fortran/29396] New: segfault with character pointer association fxcoudert at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-05-05 22:55 ` jvdelisle at gcc dot gnu dot org
@ 2007-09-03 11:46 ` pault at gcc dot gnu dot org
  2007-09-10  2:42 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-09-03 11:46 UTC (permalink / raw)
  To: gcc-bugs



-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-03-16 15:15:54         |2007-09-03 11:46:39
               date|                            |


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29396] segfault with character pointer association
  2006-10-08 21:46 [Bug fortran/29396] New: segfault with character pointer association fxcoudert at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2007-09-03 11:46 ` pault at gcc dot gnu dot org
@ 2007-09-10  2:42 ` patchapp at dberlin dot org
  2007-09-16  9:18 ` pault at gcc dot gnu dot org
  2007-09-16  9:40 ` pault at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: patchapp at dberlin dot org @ 2007-09-10  2:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from patchapp at dberlin dot org  2007-09-10 02:42 -------
Subject: Bug number PR29396

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-09/msg00779.html


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29396] segfault with character pointer association
  2006-10-08 21:46 [Bug fortran/29396] New: segfault with character pointer association fxcoudert at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2007-09-10  2:42 ` patchapp at dberlin dot org
@ 2007-09-16  9:18 ` pault at gcc dot gnu dot org
  2007-09-16  9:40 ` pault at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-09-16  9:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2007-09-16 09:18 -------
Subject: Bug 29396

Author: pault
Date: Sun Sep 16 09:17:49 2007
New Revision: 128523

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128523
Log:
2007-09-16  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/29396
        PR fortran/29606
        PR fortran/30625
        PR fortran/30871
        * trans.h : Add extra argument to gfc_build_array_ref. Rename
        gfc_conv_aliased_arg to gfc_conv_subref_array_arg.  Move
        prototype of is_aliased_array to gfortran.h and rename it
        gfc_is_subref_array.  Add field span to lang_decl, add a new
        decl lang specific flag accessed by GFC_DECL_SUBREF_ARRAY_P
        and a new type flag GFC_DECL_SUBREF_ARRAY_P.
        * trans.c (gfc_build_array_ref): Add the new argument, decl.
        If this is a subreference array pointer, use the lang_decl
        field 'span' to calculate the offset in bytes and use pointer
        arithmetic to address the element.
        * trans-array.c (gfc_conv_scalarized_array_ref,
        gfc_conv_array_ref): Add the backend declaration as the third
        field, if it is likely to be a subreference array pointer.
        (gfc_conv_descriptor_dimension, gfc_trans_array_ctor_element,
        gfc_trans_array_constructor_element, structure_alloc_comps,
        gfc_conv_array_index_offset): For all other references to
        gfc_build_array_ref, set the third argument to NULL.
        (gfc_get_dataptr_offset): New function.
        (gfc_conv_expr_descriptor): If the rhs of a pointer assignment
        is a subreference array, then calculate the offset to the
        subreference of the first element and set the descriptor data
        pointer to this, using gfc_get_dataptr_offset.
        trans-expr.c (gfc_get_expr_charlen): Use the expression for the
        character length for a character subreference.
        (gfc_conv_substring, gfc_conv_subref_array_arg): Add NULL for
        third argument in call to gfc_build_array_ref.
        (gfc_conv_aliased_arg): Rename to gfc_conv_subref_array_arg.
        (is_aliased_array): Remove.
        (gfc_conv_function_call): Change reference to is_aliased_array
        to gfc_is_subref_array and reference to gfc_conv_aliased_arg to
        gfc_conv_subref_array_arg.
        (gfc_trans_pointer_assignment): Add the array element length to
        the lang_decl 'span' field.
        * gfortran.h : Add subref_array_pointer to symbol_attribute and
        add the prototype for gfc_is_subref_array.
        * trans-stmt.c : Add NULL for third argument in all references
        to gfc_build_array_ref.
        * expr.c (gfc_is_subref_array): Renamed is_aliased_array.
        If this is a subreference array pointer, return true.
        (gfc_check_pointer_assign): If the rhs is a subreference array,
        set the lhs subreference_array_pointer attribute.
        * trans-decl.c (gfc_get_symbol_decl): Allocate the lang_decl
        field if the symbol is a subreference array pointer and set an
        initial value of zero for the 'span' field.
        * trans-io.c (set_internal_unit): Refer to is_subref_array and
        gfc_conv_subref_array_arg.
        (nml_get_addr_expr): Add NULL third argument to
        gfc_build_array_ref. 
        (gfc_trans_transfer): Use the scalarizer for a subreference
        array.

2007-09-16  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/29396
        PR fortran/29606
        PR fortran/30625
        PR fortran/30871
        * gfortran.dg/subref_array_pointer_1.f90: New test.
        * gfortran.dg/subref_array_pointer_2.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/subref_array_pointer_1.f90
    trunk/gcc/testsuite/gfortran.dg/subref_array_pointer_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/fortran/trans-io.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/fortran/trans.c
    trunk/gcc/fortran/trans.h
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/29396] segfault with character pointer association
  2006-10-08 21:46 [Bug fortran/29396] New: segfault with character pointer association fxcoudert at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2007-09-16  9:18 ` pault at gcc dot gnu dot org
@ 2007-09-16  9:40 ` pault at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-09-16  9:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pault at gcc dot gnu dot org  2007-09-16 09:40 -------
Fixed on trunk

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-09-16  9:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-08 21:46 [Bug fortran/29396] New: segfault with character pointer association fxcoudert at gcc dot gnu dot org
2006-10-08 21:46 ` [Bug fortran/29396] " fxcoudert at gcc dot gnu dot org
2007-01-28 22:15 ` jvdelisle at gcc dot gnu dot org
2007-01-30 23:24 ` jvdelisle at gcc dot gnu dot org
2007-03-16 15:14 ` fxcoudert at gcc dot gnu dot org
2007-03-16 15:16 ` fxcoudert at gcc dot gnu dot org
2007-03-16 19:30 ` fxcoudert at gcc dot gnu dot org
2007-05-05 22:55 ` jvdelisle at gcc dot gnu dot org
2007-09-03 11:46 ` pault at gcc dot gnu dot org
2007-09-10  2:42 ` patchapp at dberlin dot org
2007-09-16  9:18 ` pault at gcc dot gnu dot org
2007-09-16  9:40 ` pault at gcc dot gnu dot org

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).