public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54243] New: f951: internal compiler error: Segmentation fault (trying to compile errorneous code)
@ 2012-08-13 14:50 slayoo at staszic dot waw.pl
  2012-08-13 15:35 ` [Bug fortran/54243] [OOP] ICE (segfault) in gfc_type_compatible for invalid BT_CLASS burnus at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: slayoo at staszic dot waw.pl @ 2012-08-13 14:50 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54243
           Summary: f951: internal compiler error: Segmentation fault
                    (trying to compile errorneous code)
    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


With Deabian's gcc-snapshot gfortran (4.8.0 20120714) trying to compile to code
below:



module aqq_m
  type :: aqq_t
    contains
    procedure :: aqq_init
  end type 
  contains
  subroutine aqq_init(this)
    class(aqq_t) :: this
  end subroutine
end module
program bug2
  use aqq_m
  class(aqq_t) :: aqq
  call aqq%aqq_init
end program



I get:



$ /usr/lib/gcc-snapshot/bin/gfortran -std=f2008 -ffree-form  bug2.f
bug2.f:24.21:

  class(aqq_t) :: aqq
                     1   
Error: CLASS variable 'aqq' at (1) must be dummy, allocatable or pointer
f951: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.



HTH,
Sylwester


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

* [Bug fortran/54243] [OOP] ICE (segfault) in gfc_type_compatible for invalid BT_CLASS
  2012-08-13 14:50 [Bug fortran/54243] New: f951: internal compiler error: Segmentation fault (trying to compile errorneous code) slayoo at staszic dot waw.pl
@ 2012-08-13 15:35 ` burnus at gcc dot gnu.org
  2012-08-13 19:21 ` janus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-08-13 15:35 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |error-recovery,
                   |                            |ice-on-invalid-code
   Last reconfirmed|                            |2012-08-13
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |janus at gcc dot gnu.org
     Ever Confirmed|0                           |1
            Summary|f951: internal compiler     |[OOP] ICE (segfault) in
                   |error: Segmentation fault   |gfc_type_compatible for
                   |(trying to compile          |invalid BT_CLASS
                   |errorneous code)            |

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-08-13 15:35:11 UTC ---
Segfaults in

4837    gfc_type_compatible (gfc_typespec *ts1, gfc_typespec *ts2)
4838    {
4839      bool is_class1 = (ts1->type == BT_CLASS);
4840      bool is_class2 = (ts2->type == BT_CLASS);
...
4853      else if (is_class1 && is_class2)
4854        return gfc_type_is_extension_of
(ts1->u.derived->components->ts.u.derived,
4855                                        
ts2->u.derived->components->ts.u.derived);

The problem is that ts2->u.derived->components == NULL.


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

* [Bug fortran/54243] [OOP] ICE (segfault) in gfc_type_compatible for invalid BT_CLASS
  2012-08-13 14:50 [Bug fortran/54243] New: f951: internal compiler error: Segmentation fault (trying to compile errorneous code) slayoo at staszic dot waw.pl
  2012-08-13 15:35 ` [Bug fortran/54243] [OOP] ICE (segfault) in gfc_type_compatible for invalid BT_CLASS burnus at gcc dot gnu.org
@ 2012-08-13 19:21 ` janus at gcc dot gnu.org
  2012-08-14 21:27 ` janus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2012-08-13 19:21 UTC (permalink / raw)
  To: gcc-bugs

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

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 #2 from janus at gcc dot gnu.org 2012-08-13 19:21:15 UTC ---
I think the proper fix for both this one and PR 54244 would be the following:

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c    (revision 190186)
+++ gcc/fortran/resolve.c    (working copy)
@@ -5793,6 +5795,9 @@ check_typebound_baseobject (gfc_expr* e)

   gcc_assert (base->ts.type == BT_DERIVED || base->ts.type == BT_CLASS);

+  if (base->ts.type == BT_CLASS && !gfc_expr_attr (base).class_ok)
+    return FAILURE;
+
   /* F08:C611.  */
   if (base->ts.type == BT_DERIVED && base->ts.u.derived->attr.abstract)
     {


This aborts the resolution of the type-bound call rather early (if the passed
object was not properly declared), avoiding all problems that one could
possibly run into later. It is also general enough that it should work for
other similar cases.


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

* [Bug fortran/54243] [OOP] ICE (segfault) in gfc_type_compatible for invalid BT_CLASS
  2012-08-13 14:50 [Bug fortran/54243] New: f951: internal compiler error: Segmentation fault (trying to compile errorneous code) slayoo at staszic dot waw.pl
  2012-08-13 15:35 ` [Bug fortran/54243] [OOP] ICE (segfault) in gfc_type_compatible for invalid BT_CLASS burnus at gcc dot gnu.org
  2012-08-13 19:21 ` janus at gcc dot gnu.org
@ 2012-08-14 21:27 ` janus at gcc dot gnu.org
  2012-08-15 22:12 ` janus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2012-08-14 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from janus at gcc dot gnu.org 2012-08-14 21:27:25 UTC ---
The patch in comment 2 regresses on typebound_operator_11.f90, which can be
fixed by the following:

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c    (revision 190186)
+++ gcc/fortran/resolve.c    (working copy)
@@ -237,6 +237,7 @@ resolve_procedure_interface (gfc_symbol *sym)
       sym->attr.always_explicit = ifc->attr.always_explicit;
       sym->attr.ext_attr |= ifc->attr.ext_attr;
       sym->attr.is_bind_c = ifc->attr.is_bind_c;
+      sym->attr.class_ok = ifc->attr.class_ok;
       /* Copy array spec.  */
       sym->as = gfc_copy_array_spec (ifc->as);
       if (sym->as)
@@ -11982,6 +11986,7 @@ resolve_fl_derived0 (gfc_symbol *sym)
           c->attr.recursive = ifc->attr.recursive;
           c->attr.always_explicit = ifc->attr.always_explicit;
           c->attr.ext_attr |= ifc->attr.ext_attr;
+          c->attr.class_ok = ifc->attr.class_ok;
           /* Replace symbols in array spec.  */
           if (c->as)
         {


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

* [Bug fortran/54243] [OOP] ICE (segfault) in gfc_type_compatible for invalid BT_CLASS
  2012-08-13 14:50 [Bug fortran/54243] New: f951: internal compiler error: Segmentation fault (trying to compile errorneous code) slayoo at staszic dot waw.pl
                   ` (2 preceding siblings ...)
  2012-08-14 21:27 ` janus at gcc dot gnu.org
@ 2012-08-15 22:12 ` janus at gcc dot gnu.org
  2012-08-15 22:19 ` janus at gcc dot gnu.org
  2013-02-19 20:37 ` LpSolit at netscape dot net
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2012-08-15 22:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from janus at gcc dot gnu.org 2012-08-15 22:11:15 UTC ---
Author: janus
Date: Wed Aug 15 22:11:03 2012
New Revision: 190420

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190420
Log:
2012-08-15  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/54243
    PR fortran/54244
    * resolve.c (check_typebound_baseobject): Check for class_ok attribute.
    (resolve_procedure_interface,resolve_fl_derived0): Copy class_ok
    attribute.

2012-08-15  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/54243
    PR fortran/54244
    * gfortran.dg/typebound_call_24.f03: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/typebound_call_24.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/54243] [OOP] ICE (segfault) in gfc_type_compatible for invalid BT_CLASS
  2012-08-13 14:50 [Bug fortran/54243] New: f951: internal compiler error: Segmentation fault (trying to compile errorneous code) slayoo at staszic dot waw.pl
                   ` (3 preceding siblings ...)
  2012-08-15 22:12 ` janus at gcc dot gnu.org
@ 2012-08-15 22:19 ` janus at gcc dot gnu.org
  2013-02-19 20:37 ` LpSolit at netscape dot net
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2012-08-15 22:19 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

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

--- Comment #5 from janus at gcc dot gnu.org 2012-08-15 22:19:14 UTC ---
Fixed with r190420. Closing.

Thanks for the report!


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

* [Bug fortran/54243] [OOP] ICE (segfault) in gfc_type_compatible for invalid BT_CLASS
  2012-08-13 14:50 [Bug fortran/54243] New: f951: internal compiler error: Segmentation fault (trying to compile errorneous code) slayoo at staszic dot waw.pl
                   ` (4 preceding siblings ...)
  2012-08-15 22:19 ` janus at gcc dot gnu.org
@ 2013-02-19 20:37 ` LpSolit at netscape dot net
  5 siblings, 0 replies; 7+ messages in thread
From: LpSolit at netscape dot net @ 2013-02-19 20:37 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from janus at gcc dot gnu.org 2012-09-04 08:03:18 UTC ---
Author: janus
Date: Tue Sep  4 08:03:09 2012
New Revision: 190910

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190910
Log:
2012-09-04  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/54435
    PR fortran/54443
    * match.c (gfc_match_select_type): Make sure to only access CLASS_DATA
    for BT_CLASS.

2012-09-04  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/54243
    PR fortran/54244
    * gfortran.dg/select_type_29.f03: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/select_type_29.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/match.c
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2013-02-19 20:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-13 14:50 [Bug fortran/54243] New: f951: internal compiler error: Segmentation fault (trying to compile errorneous code) slayoo at staszic dot waw.pl
2012-08-13 15:35 ` [Bug fortran/54243] [OOP] ICE (segfault) in gfc_type_compatible for invalid BT_CLASS burnus at gcc dot gnu.org
2012-08-13 19:21 ` janus at gcc dot gnu.org
2012-08-14 21:27 ` janus at gcc dot gnu.org
2012-08-15 22:12 ` janus at gcc dot gnu.org
2012-08-15 22:19 ` janus at gcc dot gnu.org
2013-02-19 20:37 ` LpSolit at netscape dot net

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).