public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/44735]  New: ICE on FORALL with character array pointer
@ 2010-06-30 21:34 jkrahn at nc dot rr dot com
  2010-07-01  6:21 ` [Bug fortran/44735] " burnus at gcc dot gnu dot org
  2010-08-18 18:55 ` pault at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: jkrahn at nc dot rr dot com @ 2010-06-30 21:34 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 855 bytes --]

$ cat bug3.f90
subroutine bug
  character(len=10) :: F_string
  character(len=1), dimension(:), pointer :: p_chars
  forall (i=1:len(F_string))
    F_string(i:i) = p_chars(i)
  end forall
end subroutine bug

$ /usr/local/gfortran/bin/gfortran -c bug3.f90
bug3.f90: In function ‘bug’:
bug3.f90:1:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


-- 
           Summary: ICE on FORALL with character array pointer
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jkrahn at nc dot rr dot com


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


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

* [Bug fortran/44735] ICE on FORALL with character array pointer
  2010-06-30 21:34 [Bug fortran/44735] New: ICE on FORALL with character array pointer jkrahn at nc dot rr dot com
@ 2010-07-01  6:21 ` burnus at gcc dot gnu dot org
  2010-08-18 18:55 ` pault at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-07-01  6:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2010-07-01 06:21 -------
Confirm.

Valgrind shows:

==11328== Invalid read of size 8
==11328==    at 0x6CBB86: fold_convert_loc (fold-const.c:1856)
==11328==    by 0x58E7A3: allocate_temp_for_forall_nest_1 (trans-stmt.c:2583)
==11328==    by 0x58F394: gfc_trans_assign_need_temp (trans-stmt.c:2702)
==11328==    by 0x59284C: gfc_trans_forall_1 (trans-stmt.c:3158)
==11328==    by 0x551DFF: trans_code (trans.c:1205)

Failing is the following line in fold-const.c
  tree orig = TREE_TYPE (arg);
which is the second argument in the following line of
allocate_temp_for_forall_nest_1:
   unit = fold_convert (gfc_array_index_type, TYPE_SIZE_UNIT (type));

It is set in gfc_trans_assign_need_temp:

  if (expr1->ts.type == BT_CHARACTER && expr1->ts.u.cl->length)
    ...
  else
    type = gfc_typenode_for_spec (&expr1->ts);

For the example, expr1->ts.type == BT_CHARACTER but expr1->ts.u.cl->length ==
NULL.

The symbol itself has:
(gdb) p *expr1->symtree->n.sym->ts.u.cl->length->value.integer._mp_d
$8 = 10

And the size is given by the expression:
(gdb) p expr1->ref->u.ss.start->expr_type 
$19 = EXPR_VARIABLE


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.3.4 4.4.0 4.5.1 4.6.0
   Last reconfirmed|0000-00-00 00:00:00         |2010-07-01 06:21:38
               date|                            |


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


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

* [Bug fortran/44735] ICE on FORALL with character array pointer
  2010-06-30 21:34 [Bug fortran/44735] New: ICE on FORALL with character array pointer jkrahn at nc dot rr dot com
  2010-07-01  6:21 ` [Bug fortran/44735] " burnus at gcc dot gnu dot org
@ 2010-08-18 18:55 ` pault at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-08-18 18:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2010-08-18 18:55 -------
Created an attachment (id=21513)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21513&action=view)
The beginings of a fix

This PR is going to drive me mad!

The immediate cause is a failure to get the TYPE_SIZE_UNIT to calculate the
size of the temporary needed for the assignment.  This fixes that part of the
problem but moves the focus to the assignment itself.  Something is badly wrong
with the temporary's TREE_TYPE but I do not see what it is right now.

Let this be the record of where I got to....

Paul


-- 


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


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

end of thread, other threads:[~2010-08-18 18:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-30 21:34 [Bug fortran/44735] New: ICE on FORALL with character array pointer jkrahn at nc dot rr dot com
2010-07-01  6:21 ` [Bug fortran/44735] " burnus at gcc dot gnu dot org
2010-08-18 18:55 ` 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).