public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/58157] ICE on character function with len given by a PURE function
Date: Wed, 14 Aug 2013 16:15:00 -0000	[thread overview]
Message-ID: <bug-58157-4-6fBuERSWHN@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58157-4@http.gcc.gnu.org/bugzilla/>

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |janus at gcc dot gnu.org

--- Comment #1 from janus at gcc dot gnu.org ---
Slightly further compactified test case:


MODULE fortrand
  IMPLICIT NONE
CONTAINS

  integer PURE FUNCTION strlenf (string)
    CHARACTER, INTENT(in) :: string(:)
    strlenf = 1
  END FUNCTION

  FUNCTION strtofchar_chararr (string) RESULT (fchar)
    CHARACTER, INTENT(in) :: string(:)
    CHARACTER(len=strlenf(string)) :: fchar
  END FUNCTION

END MODULE

PROGRAM icetest
  USE fortrand
  IMPLICIT NONE
  print *,strtofchar_chararr((/'c'/)) ! ICE here!!!
END


I can confirm the ICE with various versions between 4.3 and trunk. Curiously
the ICE only appears if the 'string' argument is present (and of type
CHARACTER). Also it disappears when moving 'strtofchar_chararr' out of the
module into the main program.


The backtrace with trunk is:

icetest.f90:20:0: internal compiler error: Segmentation fault
   print *,strtofchar_chararr((/'c'/)) ! ICE here!!!
 ^
0x8bb59f crash_signal
        /home/janus/gcc49/trunk/gcc/toplev.c:335
0x7263d8 size_binop_loc(unsigned int, tree_code, tree_node*, tree_node*)
        /home/janus/gcc49/trunk/gcc/fold-const.c:1480
0x6f3efa get_inner_reference(tree_node*, long*, long*, tree_node**,
machine_mode*, int*, int*, bool)
        /home/janus/gcc49/trunk/gcc/expr.c:6674
0x7286a9 fold_unary_loc(unsigned int, tree_code, tree_node*, tree_node*)
        /home/janus/gcc49/trunk/gcc/fold-const.c:8044
0x728f37 fold_build1_stat_loc(unsigned int, tree_code, tree_node*, tree_node*)
        /home/janus/gcc49/trunk/gcc/fold-const.c:14944
0x5aff7a convert(tree_node*, tree_node*)
        /home/janus/gcc49/trunk/gcc/fortran/convert.c:102
0x5c256a gfc_get_dataptr_offset
        /home/janus/gcc49/trunk/gcc/fortran/trans-array.c:6250
0x5cd442 gfc_conv_expr_descriptor(gfc_se*, gfc_expr*)
        /home/janus/gcc49/trunk/gcc/fortran/trans-array.c:6910
0x5cdf9e gfc_conv_array_parameter(gfc_se*, gfc_expr*, bool, gfc_symbol const*,
char const*, tree_node**)
        /home/janus/gcc49/trunk/gcc/fortran/trans-array.c:7141
0x5e80ab gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*,
gfc_expr*, vec<tree_node*, va_gc, vl_embed>*)
        /home/janus/gcc49/trunk/gcc/fortran/trans-expr.c:4494
0x5eadfa gfc_conv_function_expr
        /home/janus/gcc49/trunk/gcc/fortran/trans-expr.c:5563
0x5e4819 gfc_apply_interface_mapping(gfc_interface_mapping*, gfc_se*,
gfc_expr*)
        /home/janus/gcc49/trunk/gcc/fortran/trans-expr.c:3554
0x5e97ab gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*,
gfc_expr*, vec<tree_node*, va_gc, vl_embed>*)
        /home/janus/gcc49/trunk/gcc/fortran/trans-expr.c:4869
0x5eadfa gfc_conv_function_expr
        /home/janus/gcc49/trunk/gcc/fortran/trans-expr.c:5563
0x5e1bef gfc_conv_expr_reference(gfc_se*, gfc_expr*)
        /home/janus/gcc49/trunk/gcc/fortran/trans-expr.c:6356
0x5ffe91 gfc_trans_transfer(gfc_code*)
        /home/janus/gcc49/trunk/gcc/fortran/trans-io.c:2302
0x5bcad7 trans_code
        /home/janus/gcc49/trunk/gcc/fortran/trans.c:1825
0x5fdc28 build_dt
        /home/janus/gcc49/trunk/gcc/fortran/trans-io.c:1835
0x5bcaf7 trans_code
        /home/janus/gcc49/trunk/gcc/fortran/trans.c:1797
0x5dbb62 gfc_generate_function_code(gfc_namespace*)
        /home/janus/gcc49/trunk/gcc/fortran/trans-decl.c:5527


  reply	other threads:[~2013-08-14 16:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-14 15:19 [Bug fortran/58157] New: " dcesari69 at gmail dot com
2013-08-14 16:15 ` janus at gcc dot gnu.org [this message]
2013-08-14 16:56 ` [Bug fortran/58157] " dominiq at lps dot ens.fr

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-58157-4-6fBuERSWHN@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).