Summary: | ICE on assumed length character result | ||
---|---|---|---|
Product: | gcc | Reporter: | Jakub Jelinek <jakub> |
Component: | fortran | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | gcc-bugs, Joost.VandeVondele, tobi |
Priority: | P3 | Keywords: | ice-on-invalid-code |
Version: | 4.1.0 | ||
Target Milestone: | 4.0.3 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2005-11-07 13:25:23 | |
Bug Depends on: | |||
Bug Blocks: | 19276, 15809 |
Description
Jakub Jelinek
2005-11-07 13:09:50 UTC
Confirmed. Blocks PR 15809 because a related testcase is referenced in comment #13. The following patch fixes this PR. Please note that it has yet to be regtested but I do not see any problems with it. I do not thank that PR15809 has anything to do with this one. Index: gcc/gcc/fortran/resolve.c =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/fortran/resolve.c,v retrieving revision 1.63 diff -c -p -r1.63 resolve.c *** gcc/gcc/fortran/resolve.c 24 Oct 2005 19:28:17 -0000 1.63 --- gcc/gcc/fortran/resolve.c 10 Nov 2005 15:48:51 -0000 *************** resolve_contained_fntype (gfc_symbol * s *** 294,299 **** --- 294,307 ---- sym->attr.untyped = 1; } } + + if (sym->ts.type == BT_CHARACTER) + { + gfc_charlen *cl = sym->ts.cl; + if (!cl || !cl->length) + gfc_error ("Character-valued internal function '%s' at %L must " + "not be automatic length", sym->name, &sym->declared_at); + } } Subject: Bug 24705 Author: pault Date: Mon Nov 21 16:05:58 2005 New Revision: 107310 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107310 Log: 2005-11-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/24223 * resolve.c (resolve_contained_fntype) Error if an internal function is assumed character length. PR fortran/24705 * trans-decl.c (gfc_create_module_variable) Skip ICE in when backend decl has been built and the symbol is marked as being in an equivalence statement. 2005-11-21 Paul Thomas <pault@gcc.gnu.org PR fortran/24223 * gfortran.dg/substring_equivalence.f90: New test. PR fortran/24705 * gfortran.dg/auto_internal_assumed.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/auto_internal_assumed.f90 (with props) trunk/gcc/testsuite/gfortran.dg/substring_equivalence.f90 (with props) Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/fortran/trans-decl.c trunk/gcc/testsuite/ChangeLog Added: trunk/gcc/testsuite/gfortran.dg/auto_internal_assumed.f90 URL: http://gcc.gnu.org/viewcvs/trunk/gcc/testsuite/gfortran.dg/auto_internal_assumed.f90?root=gcc&view=auto&rev=107310 ============================================================================== --- trunk/gcc/testsuite/gfortran.dg/auto_internal_assumed.f90 (added) +++ trunk/gcc/testsuite/gfortran.dg/auto_internal_assumed.f90 Mon Nov 21 16:05:58 2005 @@ -1,0 +1,13 @@ +! { dg-do compile } +! Test fix of PR24705 - ICE on assumed character length +! internal function. +! +character (6) :: c + c = f1 () ! { dg-error "must not be assumed length" } + if (c .ne. 'abcdef') call abort +contains + function f1 () + character (*) :: f1 + f1 = 'abcdef' + end function f1 +end Propchange: trunk/gcc/testsuite/gfortran.dg/auto_internal_assumed.f90 ('svn:executable' added) Added: trunk/gcc/testsuite/gfortran.dg/substring_equivalence.f90 URL: http://gcc.gnu.org/viewcvs/trunk/gcc/testsuite/gfortran.dg/substring_equivalence.f90?root=gcc&view=auto&rev=107310 ============================================================================== --- trunk/gcc/testsuite/gfortran.dg/substring_equivalence.f90 (added) +++ trunk/gcc/testsuite/gfortran.dg/substring_equivalence.f90 Mon Nov 21 16:05:58 2005 @@ -1,0 +1,8 @@ +! { dg-do compile } +! Tests fix for PR24223 - ICE on equivalence staement. +! +module FLAGS + character(len=5) :: Encodings + character :: at, dev + equivalence ( encodings(1:1),at ), ( encodings(2:2),dev) +end module FLAGS Propchange: trunk/gcc/testsuite/gfortran.dg/substring_equivalence.f90 ('svn:executable' added) Subject: Bug 24705 Author: pault Date: Mon Nov 21 20:02:54 2005 New Revision: 107320 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107320 Log: 2005-11-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/24223 * resolve.c (resolve_contained_fntype) Error if an internal function is assumed character length. PR fortran/24705 * trans-decl.c (gfc_create_module_variable) Skip ICE in when backend decl has been built and the symbol is marked as being in an equivalence statement. 2005-11-21 Paul Thomas <pault@gcc.gnu.org PR fortran/24223 * gfortran.dg/substring_equivalence.f90: New test. PR fortran/24705 * gfortran.dg/auto_internal_assumed.f90: New test. Added: branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/auto_internal_assumed.f90 branches/gcc-4_0-branch/gcc/testsuite/gfortran.dg/substring_equivalence.f90 Modified: branches/gcc-4_0-branch/gcc/fortran/ChangeLog branches/gcc-4_0-branch/gcc/fortran/resolve.c branches/gcc-4_0-branch/gcc/fortran/trans-decl.c branches/gcc-4_0-branch/gcc/testsuite/ChangeLog *** Bug 25081 has been marked as a duplicate of this bug. *** Subject: Bug 24705 Author: pault Date: Wed Nov 30 19:26:23 2005 New Revision: 107732 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107732 Log: 2005-11-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/24223 * resolve.c (resolve_contained_fntype) Error if an internal function is assumed character length. PR fortran/24705 * trans-decl.c (gfc_create_module_variable) Skip ICE in when backend decl has been built and the symbol is marked as being in an equivalence statement. 2005-11-30 Paul Thomas <pault@gcc.gnu.org PR fortran/24223 * gfortran.dg/substring_equivalence.f90: New test. PR fortran/24705 * gfortran.dg/auto_internal_assumed.f90: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/auto_internal_assumed.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/substring_equivalence.f90 Modified: branches/gcc-4_1-branch/gcc/fortran/ChangeLog branches/gcc-4_1-branch/gcc/fortran/resolve.c branches/gcc-4_1-branch/gcc/fortran/trans-decl.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog fixed in all 4.x |