Bug 57910 - ICE (segfault) with deferred-length strings
Summary: ICE (segfault) with deferred-length strings
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: 68241 45170
  Show dependency treegraph
 
Reported: 2013-07-16 15:36 UTC by Tobias Burnus
Modified: 2016-10-07 02:04 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-09-02 00:00:00


Attachments
Test case (573 bytes, text/plain)
2013-07-16 15:36 UTC, Tobias Burnus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2013-07-16 15:36:29 UTC
Created attachment 30513 [details]
Test case

Test case by James Van Buskirk; from https://groups.google.com/forum/#!topic/comp.lang.fortran/j5GITiX1aYI

Fails with:

test.f90: In function 'strtest':
test.f90:56:0: internal compiler error: Segmentation fault
    my_ptr => str_ptr(res,fstrlen(res))
 ^
0x9862ff crash_signal
        ../../gcc/toplev.c:333
0x97b51d tree_class_check
        ../../gcc/tree.h:3812
0x97b51d layout_decl(tree_node*, unsigned int)
        ../../gcc/stor-layout.c:553
0xb7352e build_decl_stat(unsigned int, tree_code, tree_node*, tree_node*)
        ../../gcc/tree.c:4360
0x807038 create_tmp_var_raw(tree_node*, char const*)
        ../../gcc/gimplify.c:403
0x5c9c7d gfc_create_var_np
        ../../gcc/fortran/trans.c:90
0x5c9c7d gfc_create_var(tree_node*, char const*)
        ../../gcc/fortran/trans.c:107
0x5ca987 gfc_evaluate_now_loc(unsigned int, tree_node*, stmtblock_t*)
        ../../gcc/fortran/trans.c:127
0x6021a6 gfc_apply_interface_mapping(gfc_interface_mapping*, gfc_se*, gfc_expr*)
        ../../gcc/fortran/trans-expr.c:3555
0x5fe548 gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*, gfc_expr*, vec<tree_node*, va_gc, vl_embed>*)
        ../../gcc/fortran/trans-expr.c:4869
0x60035a gfc_conv_function_expr
        ../../gcc/fortran/trans-expr.c:5563
Comment 1 Dominique d'Humieres 2013-09-02 12:28:13 UTC
Confirmed at r202154.
Comment 2 lkrupp 2016-10-07 02:02:45 UTC
Author: lkrupp
Date: Fri Oct  7 02:02:13 2016
New Revision: 240850

URL: https://gcc.gnu.org/viewcvs?rev=240850&root=gcc&view=rev
Log:
2016_10-06  Louis Krupp  <louis.krupp@zoho.com>

	PR fortran/57910
	* gfortran.dg/pr57910.f90: New test.

2016-10-05  Louis Krupp  <louis.krupp@zoho.com>

	PR fortran/57910
	* trans-expr.c (gfc_add_interface_mapping): Don't try to
	dereference call-by-value scalar argument


Added:
    trunk/gcc/testsuite/gfortran.dg/pr57910.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 lkrupp 2016-10-07 02:04:26 UTC
Fixed in revision 240850.