Summary: | [4.0 only] ICE with assumed length character strings | ||
---|---|---|---|
Product: | gcc | Reporter: | Tobias Schlüter <Tobias.Schlueter> |
Component: | fortran | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | anlauf, erik.edelmann, gcc-bugs, iguchi, kloedej, Mart.Rentmeester, paulthomas2, sgk, tkoenig, tow21 |
Priority: | P2 | Keywords: | ice-on-valid-code |
Version: | tree-ssa | ||
Target Milestone: | 4.1.0 | ||
Host: | Target: | ||
Build: | Known to work: | 4.1.0 | |
Known to fail: | 4.0.2 | Last reconfirmed: | 2005-08-31 20:42:48 |
Bug Depends on: | |||
Bug Blocks: | 19276, 15809, 18883, 19242, 19292, 22518 |
Description
Tobias Schlüter
2004-05-06 16:48:15 UTC
This is different from PR15324 in that the function call is affected, not only the function itself. Confirmed. *** Bug 15958 has been marked as a duplicate of this bug. *** *** Bug 16236 has been marked as a duplicate of this bug. *** *** Bug 16941 has been marked as a duplicate of this bug. *** The patch is wrong because it does only solve part of the problem. With the testcase from the mailing list posting referred to above, we get code like this: { logical4 D.464; char[1 .. .d] * pstr.0; pstr.0 = (char[1 .. .d] *) _gfortran_internal_malloc (.d); d (pstr.0, .d, &t1, 10); where .d is used uninitialized. If the function D from the testcase is declared external, with no interface, we hit the same assertion as without the patch. Subject: Re: ICE with assumed length character strings
tobi at gcc dot gnu dot org wrote:
> If the function D from the testcase is declared external, with no interface, we
> hit the same assertion as without the patch.
>
Ugh, messed up when editing. This is meant to read:
"If the function D from the testcase is external, not contained, we hit the
same assertion as without the patch."
*** Bug 19927 has been marked as a duplicate of this bug. *** *** Bug 23654 has been marked as a duplicate of this bug. *** Working on a patch. Subject: Bug 15326 CVSROOT: /cvs/gcc Module name: gcc Changes by: rsandifo@gcc.gnu.org 2005-09-08 18:46:06 Modified files: gcc/fortran : ChangeLog trans-array.c trans-expr.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gfortran.dg: char_result_1.f90 char_result_2.f90 char_result_3.f90 char_result_4.f90 char_result_5.f90 char_result_6.f90 char_result_7.f90 char_result_8.f90 Log message: PR fortran/15326 * trans-array.c (gfc_add_loop_ss_code): Set ss->string_length in the GFC_SS_FUNCTION case too. * trans-expr.c (gfc_conv_function_val): Allow symbols to be bound to function pointers as well as function decls. (gfc_interface_sym_mapping, gfc_interface_mapping): New structures. (gfc_init_interface_mapping, gfc_free_interface_mapping) (gfc_get_interface_mapping_charlen, gfc_get_interface_mapping_array) (gfc_set_interface_mapping_bounds, gfc_add_interface_mapping) (gfc_finish_interface_mapping, gfc_apply_interface_mapping_to_cons) (gfc_apply_interface_mapping_to_ref) (gfc_apply_interface_mapping_to_expr) (gfc_apply_interface_mapping): New functions. (gfc_conv_function_call): Evaluate the arguments before working out where the result should go. Make the null pointer case provide the string length in parmse.string_length. Cope with non-constant string lengths, using the above functions to evaluate such lengths. Use a temporary typespec; don't assign to sym->cl->backend_decl. Don't assign to se->string_length when returning a cached array descriptor. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.540&r2=1.541 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-array.c.diff?cvsroot=gcc&r1=1.56&r2=1.57 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-expr.c.diff?cvsroot=gcc&r1=1.59&r2=1.60 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6030&r2=1.6031 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/char_result_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/char_result_2.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/char_result_3.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/char_result_4.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/char_result_5.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/char_result_6.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/char_result_7.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/char_result_8.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1 Patch committed to trunk. Not fixed in 4.0: $ cat > reduced.f90 program Decapitation implicit none integer, parameter :: STRING_LENGTH = 80 character (len = STRING_LENGTH) :: Text_1, Text_2 Text_2 = Decap (Text_1) stop contains function Decap (String) result (New_String) character (len = *), intent(in) :: String character (len = Len(String)) :: New_String return end function Decap end program Decapitation $ gfortran reduced.f90 reduced.f90: In function 'MAIN__': reduced.f90:11: internal compiler error: in gfc_conv_function_call, at fortran/trans-expr.c:1108 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. $ gfortran -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.0/configure --prefix=/home/ig25 --enable-languages=c,fortran Thread model: posix gcc version 4.0.2 20050917 (prerelease) All of these are fixed in 4.1.0. Since 4.0.2 is the last 4.0 release before a 4.1.0 release will be made, 4.0.2 and 4.0.1 were special releases for gfrotran. 4.0.3 should be a normal release for GCC and gfortran in that regressions are the only changes. *** Bug 25012 has been marked as a duplicate of this bug. *** |