Bug 33337 - [4.3 regression] ICE in gfc_finish_var_decl, at fortran/trans-decl.c:510
Summary: [4.3 regression] ICE in gfc_finish_var_decl, at fortran/trans-decl.c:510
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Paul Thomas
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: 32834
  Show dependency treegraph
 
Reported: 2007-09-07 18:42 UTC by Michael Richmond
Modified: 2007-09-22 16:39 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.0
Known to fail: 4.3.0
Last reconfirmed: 2007-09-16 09:42:33


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Richmond 2007-09-07 18:42:03 UTC
When I compile the module listed below using the September 6 snapshot version of gfortran, I get the following message:

c.f90: In function 'local_cum_nc_chisq':
c.f90:15: internal compiler error: in gfc_finish_var_decl, at fortran/trans-decl.c:510
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

MODULE cdf_nc_chisq_mod
  PUBLIC
  TYPE :: one_parameter
    INTEGER :: high_bound
  END TYPE one_parameter
  TYPE :: the_distribution
    TYPE (one_parameter) :: parameters(1)
  END TYPE the_distribution
  TYPE (the_distribution), PARAMETER :: the_chi_square = &
    the_distribution((/( one_parameter(0))/))
CONTAINS
  SUBROUTINE local_cum_nc_chisq()
    df0 = the_chi_square%parameters(1)%high_bound
  END SUBROUTINE local_cum_nc_chisq
END MODULE cdf_nc_chisq_mod
Comment 1 Thomas Koenig 2007-09-08 11:40:28 UTC
Confirmed.

Backtrace:

(gdb) b fancy_abort
Breakpoint 1 at 0x817cfe0: file ../../../gcc/trunk/gcc/diagnostic.c, line 654.
(gdb) r mm.f90
Starting program: /home/ig25/libexec/gcc/i686-pc-linux-gnu/4.3.0/f951 mm.f90
 local_cum_nc_chisq
Breakpoint 1, fancy_abort (file=0x876a8e4 "../../../gcc/trunk/gcc/fortran/trans-decl.c", line=510, 
    function=0x876adf0 "gfc_finish_var_decl") at ../../../gcc/trunk/gcc/diagnostic.c:654
654     {
(gdb) up
#1  0x080e0cf1 in gfc_finish_var_decl (decl=0xb7b1d05c, sym=0x8926b58) at ../../../gcc/trunk/gcc/fortran/trans-decl.c:510
510           gcc_assert (current_function_decl == NULL_TREE || sym->result == sym);
(gdb) p current_function_decl
$1 = (tree) 0xb7b1c180
(gdb) p *sym
$2 = {name = 0x892554c "the_chi_square", module = 0x89254f5 "cdf_nc_chisq_mod", declared_at = {nextc = 0x88d7336 " = &", 
    lb = 0x88d72f0}, ts = {type = BT_DERIVED, kind = 0, derived = 0x8926790, cl = 0x0, is_c_interop = 0, is_iso_c = 0, 
    f90_type = BT_DERIVED}, attr = {allocatable = 0, dimension = 0, external = 0, intrinsic = 0, optional = 0, pointer = 0, 
    target = 0, value = 0, volatile_ = 0, dummy = 0, result = 0, assign = 0, threadprivate = 0, not_always_present = 0, 
    implied_index = 0, save = SAVE_IMPLICIT, data = 0, protected = 0, use_assoc = 0, use_only = 0, imported = 0, 
    in_namelist = 0, in_common = 0, in_equivalence = 0, function = 0, subroutine = 0, procedure = 0, generic = 0, 
    generic_copy = 0, implicit_type = 0, untyped = 0, is_bind_c = 0, is_c_interop = 0, is_iso_c = 0, sequence = 0, 
    elemental = 0, pure = 0, recursive = 0, unmaskable = 0, masked = 0, contained = 0, mod_proc = 0, abstract = 0, 
    noreturn = 0, entry = 0, entry_master = 0, mixed_entry_master = 0, always_explicit = 0, referenced = 1, 
    ambiguous_interfaces = 0, is_main_program = 0, access = ACCESS_UNKNOWN, intent = INTENT_UNKNOWN, flavor = FL_PARAMETER, 
    if_source = IFSRC_UNKNOWN, proc = PROC_UNKNOWN, cray_pointer = 0, cray_pointee = 0, alloc_comp = 0, pointer_comp = 0, 
    private_comp = 0, volatile_ns = 0x0}, generic = 0x0, component_access = ACCESS_UNKNOWN, formal = 0x0, formal_ns = 0x0, 
  value = 0x8927410, as = 0x0, result = 0x0, components = 0x0, interface = 0x0, cp_pointer = 0x0, common_next = 0x0, 
  common_head = 0x0, dummy_order = 0, entry_id = 0, namelist = 0x0, namelist_tail = 0x0, old_symbol = 0x0, tlink = 0x0, 
  mark = 1, new = 0, equiv_built = 0, forall_index = 0, refs = 1, ns = 0x8925f68, backend_decl = 0x0, 
  from_intmod = INTMOD_NONE, intmod_sym_id = 0, binding_label = '\0' <repeats 126 times>, common_block = 0x0}
(gdb) p sym->result
$3 = (struct gfc_symbol *) 0x0
(gdb) bt
#0  fancy_abort (file=0x876a8e4 "../../../gcc/trunk/gcc/fortran/trans-decl.c", line=510, 
    function=0x876adf0 "gfc_finish_var_decl") at ../../../gcc/trunk/gcc/diagnostic.c:654
#1  0x080e0cf1 in gfc_finish_var_decl (decl=0xb7b1d05c, sym=0x8926b58) at ../../../gcc/trunk/gcc/fortran/trans-decl.c:510
#2  0x080dfc1c in gfc_get_symbol_decl (sym=0x8926b58) at ../../../gcc/trunk/gcc/fortran/trans-decl.c:995
#3  0x080e8365 in gfc_conv_variable (se=0xbff0ec34, expr=0x89275a8) at ../../../gcc/trunk/gcc/fortran/trans-expr.c:404
#4  0x080e5821 in gfc_conv_expr (se=0xbff0ec34, expr=0x89275a8) at ../../../gcc/trunk/gcc/fortran/trans-expr.c:3292
#5  0x080e7af3 in gfc_conv_expr_val (se=0xbff0ec34, expr=0xb7b1c180) at ../../../gcc/trunk/gcc/fortran/trans-expr.c:3337
#6  0x080ea8c6 in gfc_conv_intrinsic_function_args (se=0xbff0f04c, expr=<value optimized out>, argarray=0xbff0ec80, nargs=1)
    at ../../../gcc/trunk/gcc/fortran/trans-intrinsic.c:209
#7  0x080ebe54 in gfc_conv_intrinsic_conversion (se=0xbff0f04c, expr=0x8927d78)
    at ../../../gcc/trunk/gcc/fortran/trans-intrinsic.c:267
#8  0x080f2a89 in gfc_conv_intrinsic_function (se=0xbff0f04c, expr=0x8927d78)
    at ../../../gcc/trunk/gcc/fortran/trans-intrinsic.c:3820
#9  0x080e5147 in gfc_conv_function_expr (se=0xbff0f04c, expr=0xb7b1d05c)
    at ../../../gcc/trunk/gcc/fortran/trans-expr.c:2809
#10 0x080e5846 in gfc_conv_expr (se=0xbff0f04c, expr=0x8927d78) at ../../../gcc/trunk/gcc/fortran/trans-expr.c:3284
#11 0x080e688a in gfc_trans_assignment_1 (expr1=0x8927210, expr2=0x8927d78, init_flag=0 '\0')
    at ../../../gcc/trunk/gcc/fortran/trans-expr.c:4001
#12 0x080e6a55 in gfc_trans_assignment (expr1=0x8927210, expr2=0x8927d78, init_flag=32 ' ')
    at ../../../gcc/trunk/gcc/fortran/trans-expr.c:4152
#13 0x080e77b1 in gfc_trans_assign (code=0x8927280) at ../../../gcc/trunk/gcc/fortran/trans-expr.c:4164
#14 0x080c7512 in gfc_trans_code (code=0x8927280) at ../../../gcc/trunk/gcc/fortran/trans.c:970
#15 0x080de492 in gfc_generate_function_code (ns=0x8927698) at ../../../gcc/trunk/gcc/fortran/trans-decl.c:3258
#16 0x080c498a in gfc_generate_module_code (ns=0x8925f68) at ../../../gcc/trunk/gcc/fortran/trans.c:1190
#17 0x080991c6 in gfc_parse_file () at ../../../gcc/trunk/gcc/fortran/parse.c:3316
#18 0x080c023d in gfc_be_parse_file (set_yydebug=0) at ../../../gcc/trunk/gcc/fortran/f95-lang.c:300
#19 0x08344908 in toplev_main (argc=2, argv=0xbff0f4c4) at ../../../gcc/trunk/gcc/toplev.c:1045
#20 0x08108ccf in main (argc=Cannot access memory at address 0x20
) at ../../../gcc/trunk/gcc/main.c:35
Comment 2 Paul Thomas 2007-09-10 08:20:50 UTC
Michael,

I answered my own question to you - it is indeed a regression.

Cheers

Paul
Comment 3 Paul Thomas 2007-09-16 09:42:33 UTC
As the guilty party, I had better take this on.

Paul
Comment 4 Paul Thomas 2007-09-22 09:33:53 UTC
(In reply to comment #3)
> As the guilty party, I had better take this on.
> 
> Paul
> 
The patch has been posted on the list.

http://gcc.gnu.org/ml/fortran/2007-09/msg00378.html

Paul
Comment 5 Paul Thomas 2007-09-22 15:46:56 UTC
Subject: Bug 33337

Author: pault
Date: Sat Sep 22 15:46:41 2007
New Revision: 128672

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

	PR fortran/33337
	PR fortran/33376
	* trans-decl.c (gfc_create_module_variable): Output
	derived type parameters.
	* arith.c (gfc_parentheses): Return the argument if
	it is a constant expression.
	* primary.c (gfc_match_rvalue): Remove the clearing of
	the module name and the use_assoc attribute for derived
	type parameter expressions.

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

	PR fortran/33337
	* gfortran.dg/derived_comp_array_ref_3.f90: New test.

	PR fortran/33376
	* gfortran.dg/derived_comp_array_ref_4.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/derived_comp_array_ref_3.f90
    trunk/gcc/testsuite/gfortran.dg/derived_comp_array_ref_4.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/arith.c
    trunk/gcc/fortran/primary.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/testsuite/ChangeLog

Comment 6 Paul Thomas 2007-09-22 16:39:23 UTC
Fixed on trunk.

Thanks for bearing with me, Michael.

Paul
Comment 7 patchapp@dberlin.org 2007-09-24 21:45:58 UTC
Subject: Bug number PR33337

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/msg01712.html