Bug 41126 - [4.5 Regression] internal compiler error: in gfc_conv_string_tmp
Summary: [4.5 Regression] internal compiler error: in gfc_conv_string_tmp
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Michael Matz
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2009-08-19 19:19 UTC by Joost VandeVondele
Modified: 2009-08-20 15:35 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-08-20 13:48:26


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2009-08-19 19:19:33 UTC
introduced in the last few days:
> gfortran -c small.f90
small.f90: In function ‘write_cputime’:
small.f90:1:0: internal compiler error: in gfc_conv_string_tmp, at fortran/trans-expr.c:1107
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
> cat small.f90
  SUBROUTINE write_cputime( checkpoint  )
    CHARACTER(LEN=*), INTENT(IN)             :: checkpoint
    CHARACTER(LEN=LEN_TRIM(checkpoint)+7)    :: string1
       string1 = ADJUSTL(string1)
  END SUBROUTINE write_cputime
Comment 1 Joost VandeVondele 2009-08-19 19:21:47 UTC
guessing:

2009-08-17  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/40877
        * array.c (gfc_resolve_character_array_constructor): Add NULL argument
        to gfc_new_charlen.
        * decl.c (add_init_expr_to_sym,variable_decl,match_char_spec,
        gfc_match_implicit): Ditto.
        * expr.c (simplify_const_ref): Fix memory leak.
        (gfc_simplify_expr): Add NULL argument to gfc_new_charlen.
        * gfortran.h (gfc_new_charlen): Modified prototype.
        * iresolve.c (check_charlen_present,gfc_resolve_char_achar): Add NULL
        argument to gfc_new_charlen.
        * module.c (mio_charlen): Ditto.
        * resolve.c (gfc_resolve_substring_charlen,
        gfc_resolve_character_operator,fixup_charlen): Ditto.
        (resolve_fl_derived,resolve_symbol): Add argument to gfc_charlen.
        * symbol.c (gfc_new_charlen): Add argument 'old_cl' (to make a copy of
        an existing charlen).
        (gfc_set_default_type,generate_isocbinding_symbol): Fix memory leak.
        (gfc_copy_formal_args_intr): Add NULL argument to gfc_new_charlen.
        * trans-decl.c (create_function_arglist): Fix memory leak.
Comment 2 Dominique d'Humieres 2009-08-19 19:26:19 UTC
Confirmed with trunk revision 150825, the code compiles for 4.2.4, 4.3.4, 4.4.1, and 4.5.0 revision 147438.
Comment 3 kargls 2009-08-19 23:00:25 UTC
Here's the backtrace

#0  gfc_conv_string_tmp (se=0x7fffffffdd70, type=0x201afec00, len=0x201af8d20) at ../../gcc4x/gcc/fortran/trans-expr.c:1107
#1  0x000000000050c0be in gfc_conv_intrinsic_adjust (se=0x7fffffffdd70, expr=0x20191e780, fndecl=0x201ae6e00) at ../../gcc4x/gcc/fortran/trans-intrinsic.c:4189
#2  0x000000000050e901 in gfc_conv_intrinsic_function (se=0x7fffffffdd70, expr=0x20191e780) at ../../gcc4x/gcc/fortran/trans-intrinsic.c:5111
#3  0x00000000004f47fd in gfc_conv_function_expr (se=0x7fffffffdd70, expr=0x20191e780) at ../../gcc4x/gcc/fortran/trans-expr.c:3516
#4  0x00000000004f6115 in gfc_conv_expr (se=0x7fffffffdd70, expr=0x20191e780) at ../../gcc4x/gcc/fortran/trans-expr.c:4040
#5  0x00000000004f8946 in gfc_trans_assignment_1 (expr1=0x20191e6c0, expr2=0x20191e780, init_flag=0 '\0') at ../../gcc4x/gcc/fortran/trans-expr.c:4866
#6  0x00000000004f8f78 in gfc_trans_assignment (expr1=0x20191e6c0, expr2=0x20191e780, init_flag=0 '\0') at ../../gcc4x/gcc/fortran/trans-expr.c:5039
#7  0x00000000004f8fe6 in gfc_trans_assign (code=0x20191e900) at ../../gcc4x/gcc/fortran/trans-expr.c:5051
#8  0x00000000004c2082 in gfc_trans_code (code=0x20191e900) at ../../gcc4x/gcc/fortran/trans.c:1089
#9  0x00000000004ea899 in gfc_generate_function_code (ns=0x2019a6c00) at ../../gcc4x/gcc/fortran/trans-decl.c:4323
#10 0x00000000004c2558 in gfc_generate_code (ns=0x2019a6c00) at ../../gcc4x/gcc/fortran/trans.c:1302
#11 0x0000000000476245 in gfc_parse_file () at ../../gcc4x/gcc/fortran/parse.c:4021
#12 0x00000000004b2045 in gfc_be_parse_file (set_yydebug=0) at ../../gcc4x/gcc/fortran/f95-lang.c:241
#13 0x000000000092ebc4 in compile_file () at ../../gcc4x/gcc/toplev.c:1026
#14 0x0000000000930e2e in do_compile () at ../../gcc4x/gcc/toplev.c:2351
#15 0x0000000000930ee4 in toplev_main (argc=2, argv=0x7fffffffe2b8) at ../../gcc4x/gcc/toplev.c:2393
#16 0x0000000000530d8b in main (argc=2, argv=0x7fffffffe2b8) at ../../gcc4x/gcc/main.c:35

The ICE is occurring in the assert below

	1101	tree
 	1102	gfc_conv_string_tmp (gfc_se * se, tree type, tree len)
-	1103	{
 	1104	  tree var;
 	1105	  tree tmp;
 	1106	
	1107	  gcc_assert (TREE_TYPE (len) == gfc_charlen_type_node);
 	1108	

so len appears to have an invalid type.

Comment 4 janus 2009-08-20 11:54:29 UTC
(In reply to comment #1)
> guessing:
> 
> 2009-08-17  Janus Weil  <janus@gcc.gnu.org>
> 
>         PR fortran/40877

This was r150823, which seems to be working for me. 

However, I don't see why r150825 fails for Dominique then (r150824/25 are both Ada-related).
Comment 5 Joost VandeVondele 2009-08-20 12:07:00 UTC
I went checking my logs in more detail. I believe revision 150854 is fine (so sorry, my previous guess was wrong), while 150940 fails for me. That would leave three more revs from the FE:

r150856 | domob | 2009-08-17 20:55:30 +0200 (Mon, 17 Aug 2009) | 14 lines

2009-08-17  Daniel Kraft  <d@domob.eu>

r150858 | pault | 2009-08-17 22:17:12 +0200 (Mon, 17 Aug 2009) | 13 lines

2008-08-17  Paul Thomas  <pault@gcc.gnu.org>

r150875 | janus | 2009-08-18 16:23:35 +0200 (Tue, 18 Aug 2009) | 16 lines

2009-08-18  Janus Weil  <janus@gcc.gnu.org>
            Paul Thomas  <pault@gcc.gnu.org>

but I don't dare to guess this time :-)
Comment 6 Dominique d'Humieres 2009-08-20 12:15:48 UTC
> However, I don't see why r150825 fails for Dominique then (r150824/25 are both
> Ada-related).

The revision numbers are those recorded when I did the update, they are only an upper bound for the relevant changes (and I don't have more precise ones).
Comment 7 janus 2009-08-20 12:23:45 UTC
(In reply to comment #5)
> but I don't dare to guess this time :-)

Awww, come on, don't be shy ;)

Seriously, though, I'd bet that r150875 is not the culprit. Not because it's mine, but because it is completely unrelated to CHARACTER.
Comment 8 janus 2009-08-20 12:53:41 UTC
(In reply to comment #5)
> r150856 | domob | 2009-08-17 20:55:30 +0200 (Mon, 17 Aug 2009) | 14 lines
> r150858 | pault | 2009-08-17 22:17:12 +0200 (Mon, 17 Aug 2009) | 13 lines
> r150875 | janus | 2009-08-18 16:23:35 +0200 (Tue, 18 Aug 2009) | 16 lines

I just tried r150875, which also works on my machine (unless I messed something up). This means that the three guys above are all fine.

Maybe r150934?
Comment 9 janus 2009-08-20 13:11:02 UTC
> Maybe r150934?

Indeed: I just verified that r150934 is the source of this regression.
Comment 10 Michael Matz 2009-08-20 13:48:26 UTC
Mine.
Comment 11 Michael Matz 2009-08-20 15:35:19 UTC
Fixed in r150964.
Comment 12 hjl@gcc.gnu.org 2009-08-30 02:07:07 UTC
Subject: Bug 41126

Author: hjl
Date: Sun Aug 30 02:06:32 2009
New Revision: 151218

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151218
Log:
2009-08-29  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2009-08-26  H.J. Lu  <hongjiu.lu@intel.com>

	PR fortran/41162
	* gfortran.dg/pr41162.f: New.

	2009-08-26  Richard Guenther  <rguenther@suse.de>

	PR middle-end/41163
	* gcc.c-torture/compile/pr41163.c: New testcase.

	2009-08-25  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41139
	* gfortran.dg/proc_ptr_25.f90: New.
	* gfortran.dg/proc_ptr_comp_18.f90: New.
	* gfortran.dg/proc_ptr_comp_19.f90: New.

	2009-08-20  Michael Matz  <matz@suse.de>

	PR fortran/41126
	* gfortran.dg/pr41126.f90: New test.

	2009-08-20  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41121
	* gfortran.dg/intrinsic_5.f90: New.

	2009-08-19  Jason Merrill  <jason@redhat.com>

	PR c++/41120
	* g++.dg/other/gc4.C: New.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/other/gc4.C
      - copied unchanged from r151217, trunk/gcc/testsuite/g++.dg/other/gc4.C
    branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr41163.c
      - copied unchanged from r151217, trunk/gcc/testsuite/gcc.c-torture/compile/pr41163.c
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/intrinsic_5.f90
      - copied unchanged from r151217, trunk/gcc/testsuite/gfortran.dg/intrinsic_5.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr41126.f90
      - copied unchanged from r151217, trunk/gcc/testsuite/gfortran.dg/pr41126.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr41162.f
      - copied unchanged from r151216, trunk/gcc/testsuite/gfortran.dg/pr41162.f
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/proc_ptr_25.f90
      - copied unchanged from r151217, trunk/gcc/testsuite/gfortran.dg/proc_ptr_25.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/proc_ptr_comp_18.f90
      - copied unchanged from r151217, trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_18.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/proc_ptr_comp_19.f90
      - copied unchanged from r151217, trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_19.f90
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog