public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/58157] New: ICE on character function with len given by a PURE function
@ 2013-08-14 15:19 dcesari69 at gmail dot com
  2013-08-14 16:15 ` [Bug fortran/58157] " janus at gcc dot gnu.org
  2013-08-14 16:56 ` dominiq at lps dot ens.fr
  0 siblings, 2 replies; 3+ messages in thread
From: dcesari69 at gmail dot com @ 2013-08-14 15:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58157
           Summary: ICE on character function with len given by a PURE
                    function
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcesari69 at gmail dot com

Created attachment 30655
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30655&action=edit
Fortran source for reproducing ICE

Hello, the attached simplified code contains a module with a CHARACTER function
whose results' length is given by another PURE function, which I assume is
correct Fortran 95 and I have used succesfully in other contexts. The module
compiles well, but as soon as the function is encountered in another piece of
code using the module, I get an ICE (+segfault):

====
[davide@localhost ~]$ rm -f *.mod; LANG= gfortran -c icetest.f90 
icetest.f90: In function 'icetest':
icetest.f90:34:0: internal compiler error: Segmentation fault
 tkey = strtofchar_chararr(key) ! ICE here!!!
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
====

It reminds somehow bug 55287:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55827, but that one is fixed in
4.9, while this remains. Same bug with older versions of gfortran.

This is my first bug submission to gcc, so please forgive any procedural
mistake. Thank you for your work, Davide


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

* [Bug fortran/58157] ICE on character function with len given by a PURE function
  2013-08-14 15:19 [Bug fortran/58157] New: ICE on character function with len given by a PURE function dcesari69 at gmail dot com
@ 2013-08-14 16:15 ` janus at gcc dot gnu.org
  2013-08-14 16:56 ` dominiq at lps dot ens.fr
  1 sibling, 0 replies; 3+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-14 16:15 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug fortran/58157] ICE on character function with len given by a PURE function
  2013-08-14 15:19 [Bug fortran/58157] New: ICE on character function with len given by a PURE function dcesari69 at gmail dot com
  2013-08-14 16:15 ` [Bug fortran/58157] " janus at gcc dot gnu.org
@ 2013-08-14 16:56 ` dominiq at lps dot ens.fr
  1 sibling, 0 replies; 3+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-08-14 16:56 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-08-14
     Ever confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed.


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

end of thread, other threads:[~2013-08-14 16:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-14 15:19 [Bug fortran/58157] New: ICE on character function with len given by a PURE function dcesari69 at gmail dot com
2013-08-14 16:15 ` [Bug fortran/58157] " janus at gcc dot gnu.org
2013-08-14 16:56 ` dominiq at lps dot ens.fr

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