public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/55983] New: ICE in find_typebound_proc_uop, at fortran/class.c:2711
@ 2013-01-14 23:10 slayoo at staszic dot waw.pl
  2013-01-15  8:29 ` [Bug fortran/55983] [4.7/4.8 Regression] " janus at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: slayoo at staszic dot waw.pl @ 2013-01-14 23:10 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55983

             Bug #: 55983
           Summary: ICE in find_typebound_proc_uop, at
                    fortran/class.c:2711
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: slayoo@staszic.waw.pl


First, sorry for not reducing the test case further.

Second, here's the way to reproduce it:

$ cat bug2.f 
module bcd_m
  type, abstract :: bcd_t
    contains
    procedure(bcd_fill_halos), deferred :: fill_halos
  end type
  abstract interface 
    subroutine bcd_fill_halos(this)
      import :: bcd_t
      class(bcd_t ) :: this
    end subroutine
  end interface
end module

module solver_mpdata_m
  type :: mpdata_t
    class(bcd_t), pointer :: bcx, bcy
    contains
    procedure :: advop => mpdata_advop
  end type
  contains
  subroutine mpdata_advop(this)
    class(mpdata_t) :: this
    associate ( bcx => this%bcx, bcy => this%bcy )
      call bcx%fill_halos()
    end associate
  end subroutine
end module


$ /usr/lib/gcc-snapshot/bin/gfortran -ffree-form -std=f2008 bug2.f
f951: internal compiler error: in find_typebound_proc_uop, at
fortran/class.c:2711
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.


$ /usr/lib/gcc-snapshot/bin/gfortran --version
GNU Fortran (Debian 20130113-1) 4.8.0 20130113 (experimental) [trunk revision
195136]
...


HTH,
Sylwester


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/55983] [4.7/4.8 Regression] ICE in find_typebound_proc_uop, at fortran/class.c:2711
  2013-01-14 23:10 [Bug fortran/55983] New: ICE in find_typebound_proc_uop, at fortran/class.c:2711 slayoo at staszic dot waw.pl
@ 2013-01-15  8:29 ` janus at gcc dot gnu.org
  2013-01-15  8:31 ` janus at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-15  8:29 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55983

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
                 CC|                            |janus at gcc dot gnu.org
            Summary|ICE in                      |[4.7/4.8 Regression] ICE in
                   |find_typebound_proc_uop, at |find_typebound_proc_uop, at
                   |fortran/class.c:2711        |fortran/class.c:2711

--- Comment #1 from janus at gcc dot gnu.org 2013-01-15 08:27:39 UTC ---

> $ /usr/lib/gcc-snapshot/bin/gfortran -ffree-form -std=f2008 bug2.f
> f951: internal compiler error: in find_typebound_proc_uop, at
> fortran/class.c:2711

Confirmed with trunk and 4.7. (Btw, why don't you use a .f90 suffix? Then you
don't need -ffree-form ...)

4.6 correctly complains:

c0.f90:24.25:

      call bcx%fill_halos()
                         1
Error: Derived type 'bcd_t' at (1) is being used before it is defined
c0.f90:16.32:

    class(bcd_t), pointer :: bcx, bcy
                                1
Error: The pointer component 'bcx' of 'mpdata_t' at (1) is a type that has not
been declared


It seems you are missing a use statement and found an ICE-on-invalid
regression.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/55983] [4.7/4.8 Regression] ICE in find_typebound_proc_uop, at fortran/class.c:2711
  2013-01-14 23:10 [Bug fortran/55983] New: ICE in find_typebound_proc_uop, at fortran/class.c:2711 slayoo at staszic dot waw.pl
  2013-01-15  8:29 ` [Bug fortran/55983] [4.7/4.8 Regression] " janus at gcc dot gnu.org
@ 2013-01-15  8:31 ` janus at gcc dot gnu.org
  2013-01-15  9:03 ` slayoo at staszic dot waw.pl
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-15  8:31 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55983

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-01-15
     Ever Confirmed|0                           |1

--- Comment #2 from janus at gcc dot gnu.org 2013-01-15 08:30:31 UTC ---
(In reply to comment #1)
> It seems you are missing a use statement and found an ICE-on-invalid
> regression.

Btw, when adding "use bcd_m", 4.6 and 4.7 compile the test case without
problems. However, trunk gives:

internal compiler error: gfc_trans_code(): Bad statement code
       call bcx%fill_halos()
 ^
0x62ef6d trans_code
        /home/jweil/gcc48/trunk/gcc/fortran/trans.c:1653
0x62f0b0 gfc_trans_code(gfc_code*)
        /home/jweil/gcc48/trunk/gcc/fortran/trans.c:1688
0x6a172b gfc_trans_block_construct(gfc_code*)
        /home/jweil/gcc48/trunk/gcc/fortran/trans-stmt.c:1342
0x62ed4e trans_code
        /home/jweil/gcc48/trunk/gcc/fortran/trans.c:1527



This is an ICE-on-valid regression in trunk.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/55983] [4.7/4.8 Regression] ICE in find_typebound_proc_uop, at fortran/class.c:2711
  2013-01-14 23:10 [Bug fortran/55983] New: ICE in find_typebound_proc_uop, at fortran/class.c:2711 slayoo at staszic dot waw.pl
  2013-01-15  8:29 ` [Bug fortran/55983] [4.7/4.8 Regression] " janus at gcc dot gnu.org
  2013-01-15  8:31 ` janus at gcc dot gnu.org
@ 2013-01-15  9:03 ` slayoo at staszic dot waw.pl
  2013-01-15  9:10 ` janus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: slayoo at staszic dot waw.pl @ 2013-01-15  9:03 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55983

--- Comment #3 from Sylwester Arabas <slayoo at staszic dot waw.pl> 2013-01-15 09:03:28 UTC ---
Hi Janus,

Re .f90 - it's not valid f90 code after all :)

Re missing "use bcd_m" - I was aware of this case, and I submitted the "Bad
statement code" ICE as a separate issue yesterday:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55984

Regards,
Sylwester


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/55983] [4.7/4.8 Regression] ICE in find_typebound_proc_uop, at fortran/class.c:2711
  2013-01-14 23:10 [Bug fortran/55983] New: ICE in find_typebound_proc_uop, at fortran/class.c:2711 slayoo at staszic dot waw.pl
                   ` (2 preceding siblings ...)
  2013-01-15  9:03 ` slayoo at staszic dot waw.pl
@ 2013-01-15  9:10 ` janus at gcc dot gnu.org
  2013-01-15 10:09 ` janus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-15  9:10 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55983

--- Comment #4 from janus at gcc dot gnu.org 2013-01-15 09:09:50 UTC ---
Hi,

> Re .f90 - it's not valid f90 code after all :)

well, yes. But it ain't valid f77 either ;)

The file extension basically just tells gfortran whether to interpret your code
as fixed format (.f) or free format (.f90).

It's not related to -std=...


> Re missing "use bcd_m" - I was aware of this case, and I submitted the "Bad
> statement code" ICE as a separate issue yesterday:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55984

Yes, I just noticed. The test case here is slightly shorter, though.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/55983] [4.7/4.8 Regression] ICE in find_typebound_proc_uop, at fortran/class.c:2711
  2013-01-14 23:10 [Bug fortran/55983] New: ICE in find_typebound_proc_uop, at fortran/class.c:2711 slayoo at staszic dot waw.pl
                   ` (3 preceding siblings ...)
  2013-01-15  9:10 ` janus at gcc dot gnu.org
@ 2013-01-15 10:09 ` janus at gcc dot gnu.org
  2013-01-15 21:10 ` janus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-15 10:09 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55983

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
   Target Milestone|---                         |4.8.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/55983] [4.7/4.8 Regression] ICE in find_typebound_proc_uop, at fortran/class.c:2711
  2013-01-14 23:10 [Bug fortran/55983] New: ICE in find_typebound_proc_uop, at fortran/class.c:2711 slayoo at staszic dot waw.pl
                   ` (4 preceding siblings ...)
  2013-01-15 10:09 ` janus at gcc dot gnu.org
@ 2013-01-15 21:10 ` janus at gcc dot gnu.org
  2013-01-15 22:17 ` janus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-15 21:10 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55983

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 #5 from janus at gcc dot gnu.org 2013-01-15 21:10:26 UTC ---
The following patch fixes the ICE in comment 0:


Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c    (revision 195125)
+++ gcc/fortran/class.c    (working copy)
@@ -2707,15 +2707,17 @@ find_typebound_proc_uop (gfc_symbol* derived, gfc_
   gfc_symtree* res;
   gfc_symtree* root;

-  /* Set correct symbol-root.  */
-  gcc_assert (derived->f2k_derived);
-  root = (uop ? derived->f2k_derived->tb_uop_root
-          : derived->f2k_derived->tb_sym_root);
-
   /* Set default to failure.  */
   if (t)
     *t = FAILURE;

+  if (derived->f2k_derived)
+    /* Set correct symbol-root.  */
+    root = (uop ? derived->f2k_derived->tb_uop_root
+        : derived->f2k_derived->tb_sym_root);
+  else
+    return NULL;
+
   /* Try to find it in the current type's namespace.  */
   res = gfc_find_symtree (root, name);
   if (res && res->n.tb && !res->n.tb->error)


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/55983] [4.7/4.8 Regression] ICE in find_typebound_proc_uop, at fortran/class.c:2711
  2013-01-14 23:10 [Bug fortran/55983] New: ICE in find_typebound_proc_uop, at fortran/class.c:2711 slayoo at staszic dot waw.pl
                   ` (5 preceding siblings ...)
  2013-01-15 21:10 ` janus at gcc dot gnu.org
@ 2013-01-15 22:17 ` janus at gcc dot gnu.org
  2013-01-16 13:31 ` janus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-15 22:17 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55983

--- Comment #6 from janus at gcc dot gnu.org 2013-01-15 22:17:11 UTC ---
(In reply to comment #5)
> The following patch fixes the ICE in comment 0:

... and regtests cleanly.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/55983] [4.7/4.8 Regression] ICE in find_typebound_proc_uop, at fortran/class.c:2711
  2013-01-14 23:10 [Bug fortran/55983] New: ICE in find_typebound_proc_uop, at fortran/class.c:2711 slayoo at staszic dot waw.pl
                   ` (6 preceding siblings ...)
  2013-01-15 22:17 ` janus at gcc dot gnu.org
@ 2013-01-16 13:31 ` janus at gcc dot gnu.org
  2013-01-16 19:52 ` janus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-16 13:31 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55983

--- Comment #7 from janus at gcc dot gnu.org 2013-01-16 13:30:42 UTC ---
Further reduced test case:

  type :: mpdata_t
    class(bcd_t), pointer :: bcx, bcy
  end type
  type(mpdata_t) :: this
  call this%bcx%fill_halos()
end


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/55983] [4.7/4.8 Regression] ICE in find_typebound_proc_uop, at fortran/class.c:2711
  2013-01-14 23:10 [Bug fortran/55983] New: ICE in find_typebound_proc_uop, at fortran/class.c:2711 slayoo at staszic dot waw.pl
                   ` (7 preceding siblings ...)
  2013-01-16 13:31 ` janus at gcc dot gnu.org
@ 2013-01-16 19:52 ` janus at gcc dot gnu.org
  2013-01-17 10:56 ` janus at gcc dot gnu.org
  2013-01-17 10:58 ` janus at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-16 19:52 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55983

--- Comment #8 from janus at gcc dot gnu.org 2013-01-16 19:52:15 UTC ---
Author: janus
Date: Wed Jan 16 19:52:10 2013
New Revision: 195251

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195251
Log:
2013-01-16  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/55983
    * class.c (find_typebound_proc_uop): Check for f2k_derived instead of
    asserting it.


2013-01-16  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/55983
    * gfortran.dg/class_55.f90: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/class_55.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/class.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/55983] [4.7/4.8 Regression] ICE in find_typebound_proc_uop, at fortran/class.c:2711
  2013-01-14 23:10 [Bug fortran/55983] New: ICE in find_typebound_proc_uop, at fortran/class.c:2711 slayoo at staszic dot waw.pl
                   ` (8 preceding siblings ...)
  2013-01-16 19:52 ` janus at gcc dot gnu.org
@ 2013-01-17 10:56 ` janus at gcc dot gnu.org
  2013-01-17 10:58 ` janus at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-17 10:56 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55983

--- Comment #9 from janus at gcc dot gnu.org 2013-01-17 10:55:55 UTC ---
Author: janus
Date: Thu Jan 17 10:55:50 2013
New Revision: 195261

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195261
Log:
2013-01-17  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/55983
    * class.c (find_typebound_proc_uop): Check for f2k_derived instead of
    asserting it.


2013-01-17  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/55983
    * gfortran.dg/class_55.f90: New.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/class_55.f90
Modified:
    branches/gcc-4_7-branch/gcc/fortran/ChangeLog
    branches/gcc-4_7-branch/gcc/fortran/class.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/55983] [4.7/4.8 Regression] ICE in find_typebound_proc_uop, at fortran/class.c:2711
  2013-01-14 23:10 [Bug fortran/55983] New: ICE in find_typebound_proc_uop, at fortran/class.c:2711 slayoo at staszic dot waw.pl
                   ` (9 preceding siblings ...)
  2013-01-17 10:56 ` janus at gcc dot gnu.org
@ 2013-01-17 10:58 ` janus at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-17 10:58 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55983

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #10 from janus at gcc dot gnu.org 2013-01-17 10:58:42 UTC ---
Fixed on trunk and 4.7. Closing.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-01-17 10:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-14 23:10 [Bug fortran/55983] New: ICE in find_typebound_proc_uop, at fortran/class.c:2711 slayoo at staszic dot waw.pl
2013-01-15  8:29 ` [Bug fortran/55983] [4.7/4.8 Regression] " janus at gcc dot gnu.org
2013-01-15  8:31 ` janus at gcc dot gnu.org
2013-01-15  9:03 ` slayoo at staszic dot waw.pl
2013-01-15  9:10 ` janus at gcc dot gnu.org
2013-01-15 10:09 ` janus at gcc dot gnu.org
2013-01-15 21:10 ` janus at gcc dot gnu.org
2013-01-15 22:17 ` janus at gcc dot gnu.org
2013-01-16 13:31 ` janus at gcc dot gnu.org
2013-01-16 19:52 ` janus at gcc dot gnu.org
2013-01-17 10:56 ` janus at gcc dot gnu.org
2013-01-17 10:58 ` janus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).