[Bug fortran/47730] [OOP] ICE on invalid source in connection with SELECT TYPE

2016-11-16 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47730

janus at gcc dot gnu.org changed:

   What|Removed |Added

   Target Milestone|--- |4.6.0

[Bug fortran/47730] [OOP] ICE on invalid source in connection with SELECT TYPE

2011-02-14 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47730

janus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Keywords||ice-on-invalid-code
   Last reconfirmed||2011.02.14 10:23:13
 CC||janus at gcc dot gnu.org
 Ever Confirmed|0   |1
Summary|ICE as a consequence of |[OOP] ICE on invalid source
   |invalid source code |in connection with SELECT
   |attempting to register a|TYPE
   |type-bound procedure|

--- Comment #1 from janus at gcc dot gnu.org 2011-02-14 10:23:13 UTC ---
(In reply to comment #0)
 The code below produces an ICE after reporting that assign_square must be a
 module procedure or an external procedure.

Not quite. For me, the exact output is:

   procedure ::  assign_square
1
Error: Argument 'this' of 'assign_square' with PASS(this) at (1) must be of the
derived-type 'square'
f951: internal compiler error: in gfc_enforce_clean_symbol_state, at
fortran/symbol.c:3426


I think throwing the error is correct, but of course the ICE should not occur.


[Bug fortran/47730] [OOP] ICE on invalid source in connection with SELECT TYPE

2011-02-14 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47730

--- Comment #2 from janus at gcc dot gnu.org 2011-02-14 10:27:23 UTC ---
(In reply to comment #0)
 It seems related to bug #46849

Yes, in particular to comment #2 in that PR:

module m
  implicit none
  type :: dt
  end type
contains
  subroutine test(fun)
class(dt) :: fun
call extern(not_existing) ! Error: No implicit type
select type (fun)
type is (dt)  ! TYPE IS is required for the ICE
end select
  end subroutine test
end module m


which gives:

call extern(not_existing) ! Error: No implicit type
1
Error: Symbol 'not_existing' at (1) has no IMPLICIT type
f951: internal compiler error: in gfc_enforce_clean_symbol_state, at
fortran/symbol.c:3426


Same pattern: Some error, and afterwards an ICE in
'gfc_enforce_clean_symbol_state'.


[Bug fortran/47730] [OOP] ICE on invalid source in connection with SELECT TYPE

2011-02-14 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47730

--- Comment #3 from janus at gcc dot gnu.org 2011-02-14 10:32:18 UTC ---
Another related test case was recently reported by Andrew Benson at
http://gcc.gnu.org/ml/fortran/2011-02/msg00111.html:


module mod1
  type treeNode
  end type treeNode
contains
  subroutine proc1(thisNode)
class (treeNode), target, intent(in) :: thisNode
select type (thisNode)
type is (treeNode)
   workNode = thisNode
end select
  end subroutine proc1
end module mod1


workNode = thisNode
   1
Error: Non-POINTER in pointer association context (pointer assignment) at (1)
f951: internal compiler error: in gfc_enforce_clean_symbol_state, at
fortran/symbol.c:3426


[Bug fortran/47730] [OOP] ICE on invalid source in connection with SELECT TYPE

2011-02-14 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47730

janus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 AssignedTo|unassigned at gcc dot   |janus at gcc dot gnu.org
   |gnu.org |

--- Comment #4 from janus at gcc dot gnu.org 2011-02-14 21:05:56 UTC ---
The following patch fixes the ICE in all three test cases and regtests cleanly:

Index: gcc/fortran/parse.c
===
--- gcc/fortran/parse.c(revision 170150)
+++ gcc/fortran/parse.c(working copy)
@@ -3154,6 +3154,7 @@ gfc_build_block_ns (gfc_namespace *parent_ns)
   t = gfc_add_flavor (my_ns-proc_name-attr, FL_LABEL,
   my_ns-proc_name-name, NULL);
   gcc_assert (t == SUCCESS);
+  gfc_commit_symbol (my_ns-proc_name);
 }

   if (parent_ns-proc_name)


Will commit as obvious.


[Bug fortran/47730] [OOP] ICE on invalid source in connection with SELECT TYPE

2011-02-14 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47730

--- Comment #5 from janus at gcc dot gnu.org 2011-02-14 22:17:47 UTC ---
Author: janus
Date: Mon Feb 14 22:17:44 2011
New Revision: 170157

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=170157
Log:
2011-02-14  Janus Weil  ja...@gcc.gnu.org

PR fortran/47730
* parse.c (gfc_build_block_ns): Commit 'block@' symbol.

2011-02-14  Janus Weil  ja...@gcc.gnu.org

PR fortran/47730
* gfortran.dg/select_type_22.f03: New.

Added:
trunk/gcc/testsuite/gfortran.dg/select_type_22.f03
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/parse.c
trunk/gcc/testsuite/ChangeLog


[Bug fortran/47730] [OOP] ICE on invalid source in connection with SELECT TYPE

2011-02-14 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47730

janus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED

--- Comment #6 from janus at gcc dot gnu.org 2011-02-14 22:19:19 UTC ---
Fixed with r170157. Closing.

Thanks for the reports, guys!