[Bug fortran/43895] [OOP] internal compiler error: verify_ssa failed
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43895 janus at gcc dot gnu.org changed: What|Removed |Added Target Milestone|--- |4.6.0
[Bug fortran/43895] [OOP] internal compiler error: verify_ssa failed
--- Comment #12 from pault at gcc dot gnu dot org 2010-06-05 10:40 --- (In reply to comment #11) OK, all this has a simple explanation. A revamped version of the original testcase segfaults in runtime, at -O0. ! { dg-do compile } ! Test the fix for PR43895, in which the dummy 'a' was not ! dereferenced for the deallocation of component 'a', as required ! for INTENT(OUT). ! ! Contributed by Salvatore Filippone sfilipp...@uniroma2.it ! module d_mat_mod type :: base_sparse_mat end type base_sparse_mat type, extends(base_sparse_mat) :: d_base_sparse_mat integer :: i end type d_base_sparse_mat type :: d_sparse_mat class(d_base_sparse_mat), allocatable :: a end type d_sparse_mat end module d_mat_mod use d_mat_mod type(d_sparse_mat) :: b allocate (b%a) b%a%i = 42 call bug14 (b) if (allocated (b%a)) call abort contains subroutine bug14(a) implicit none type(d_sparse_mat), intent(out) :: a end subroutine bug14 end ! { dg-final { cleanup-modules d_mat_mod } } The reason is quite clear from the code below: bug14 (struct d_sparse_mat restrict a) { if (a.a.$data != 0B) { __builtin_free ((void *) a.a.$data); } a.a.$data = 0B; } The dummy 'a' needs dereferencing, thus... bug14 (struct d_sparse_mat restrict a) { if (a-a.$data != 0B) { __builtin_free ((void *) a-a.$data); } a-a.$data = 0B; } This patch is regtesting right now: Index: /svn/trunk/gcc/fortran/trans-array.c === *** /svn/trunk/gcc/fortran/trans-array.c(revision 159851) --- /svn/trunk/gcc/fortran/trans-array.c(working copy) *** structure_alloc_comps (gfc_symbol * der_ *** 5951,5957 gfc_init_block (fnblock); ! if (POINTER_TYPE_P (TREE_TYPE (decl)) rank != 0) decl = build_fold_indirect_ref_loc (input_location, decl); --- 5951,5958 gfc_init_block (fnblock); ! if ((POINTER_TYPE_P (TREE_TYPE (decl)) rank != 0) ! || (TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE rank == 0)) decl = build_fold_indirect_ref_loc (input_location, decl); Cheers Paul -- pault at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED Last reconfirmed|2010-04-26 15:04:01 |2010-06-05 10:40:32 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43895
[Bug fortran/43895] [OOP] internal compiler error: verify_ssa failed
--- Comment #13 from pault at gcc dot gnu dot org 2010-06-05 14:08 --- (In reply to comment #12) This is tiresome - it regtested fine, I update the tree and now I get failures on: alloc_comp_result_1.f90 alloc_comp_scalar_1.f90 alloc_comp_transformational_1.f90 All three segfault at runtime. Happily, if I revert the above patch, they still segfault. Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43895
[Bug fortran/43895] [OOP] internal compiler error: verify_ssa failed
--- Comment #14 from pault at gcc dot gnu dot org 2010-06-05 17:51 --- Subject: Bug 43895 Author: pault Date: Sat Jun 5 17:51:39 2010 New Revision: 160326 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=160326 Log: 2010-06-05 Paul Thomas pa...@gcc.gnu.org PR fortran/43895 * trans-array.c (structure_alloc_comps): Dereference scalar 'decl' if it is a REFERENCE_TYPE. Tidy expressions containing TREE_TYPE (decl). 2010-06-05 Paul Thomas pa...@gcc.gnu.org PR fortran/43895 * gfortran.dg/alloc_comp_class_1.f90 : New test. Added: trunk/gcc/testsuite/gfortran.dg/alloc_comp_class_1.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-array.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43895
[Bug fortran/43895] [OOP] internal compiler error: verify_ssa failed
--- Comment #15 from janus at gcc dot gnu dot org 2010-06-06 03:17 --- I guess we can close this, right? -- janus at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43895
[Bug fortran/43895] [OOP] internal compiler error: verify_ssa failed
--- Comment #9 from sfilippone at uniroma2 dot it 2010-05-18 10:41 --- (In reply to comment #8) (In reply to comment #7) Btw, after the recent patch for PR43969, this might well be fixed already ... Unfortunately, no, I still get the ICE. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43895
[Bug fortran/43895] [OOP] internal compiler error: verify_ssa failed
--- Comment #10 from janus at gcc dot gnu dot org 2010-05-18 12:19 --- (In reply to comment #9) Btw, after the recent patch for PR43969, this might well be fixed already ... Unfortunately, no, I still get the ICE. Sure. Actually my comment was only targeted towards Tobias' ALLOCATED example, not the original ICE :) -- janus at gcc dot gnu dot org changed: What|Removed |Added CC||burnus at gcc dot gnu dot ||org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43895
[Bug fortran/43895] [OOP] internal compiler error: verify_ssa failed
--- Comment #11 from burnus at gcc dot gnu dot org 2010-05-18 12:24 --- (In reply to comment #8) If one adds b = ALLOCATED(x) one finds: Where do you add this? Add in bug14 of attachment 20491 before 'end subroutine': logical b b = allocated(a%a) However, this is now fixed. * * * There are other problems related to allocatable scalars, but I think those are tracked in PR 42647. For instance (again based on attachment 20491): use d_mat_mod implicit none type(d_sparse_mat), ALLOCATABLE :: x call bug14(x) ! OK around here contains subroutine bug14(a) type(d_sparse_mat), ALLOCATABLE, intent(out) :: a logical b ! ICE here b = allocated(a); if (b) call abort() ! OK here end subroutine bug14 end -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43895
[Bug fortran/43895] [OOP] internal compiler error: verify_ssa failed
--- Comment #7 from burnus at gcc dot gnu dot org 2010-05-17 20:22 --- Propagate comment from PR 43990: There seems to be an inconsistency with CLASS with POINTER or ALLOCATABLE attribute: Is class.$DATA or class the pointer variable. If one adds b = ALLOCATED(x) one finds: x.a.$data = 0B; ! Default initialization sets class.$data to NULL D.1577 = x-a; ! ALLOCATED check looks at (class != NULL) b = D.1577 != 0B; Which does not make sense. [This might be unrelated to the ICE.] -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43895
[Bug fortran/43895] [OOP] internal compiler error: verify_ssa failed
--- Comment #8 from janus at gcc dot gnu dot org 2010-05-17 20:35 --- (In reply to comment #7) If one adds b = ALLOCATED(x) one finds: Where do you add this? I don't see a test case where this fits into. Can you give a complete example? Btw, after the recent patch for PR43969, this might well be fixed already ... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43895
[Bug fortran/43895] [OOP] internal compiler error: verify_ssa failed
--- Comment #6 from burnus at gcc dot gnu dot org 2010-05-06 16:28 --- See also PR 43990 - I think the PRs might be related, though I have not really studied this PR. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43895
[Bug fortran/43895] [OOP] internal compiler error: verify_ssa failed
--- Comment #4 from janus at gcc dot gnu dot org 2010-04-26 15:04 --- Confirmed. It seems this fails already with the 4.5 release as well as with current trunk, which means that it's not specific to the fortran-dev branch. -- janus at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2010-04-26 15:04:01 date|| Summary|[fortran-dev] internal |[OOP] internal compiler |compiler error: verify_ssa |error: verify_ssa failed |failed | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43895
[Bug fortran/43895] [OOP] internal compiler error: verify_ssa failed
--- Comment #5 from sfilippone at uniroma2 dot it 2010-04-26 15:32 --- (In reply to comment #0) The attached code produces the subject message, but only with optimization; at -O0 it works. -- behaviour -- [sfili...@localhost bug14]$ gfortran -O1 -c bug14.f90 bug14.f90: In function bug14: bug14.f90:30:0: error: statement makes a memory store, but has no VDEFS a_4.a.$data = 0B; bug14.f90:30:0: internal compiler error: verify_ssa failed Please submit a full bug report, with preprocessed source if appropriate. See http://gcc.gnu.org/bugs.html for instructions. Fails at -O2 and -O3 as well.. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43895