public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54134] New: ICE overriding derived type bound function with allocatable character as result
@ 2012-07-31  7:33 koen.poppe at cs dot kuleuven.be
  2012-07-31  9:34 ` [Bug fortran/54134] [OOP] " burnus at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: koen.poppe at cs dot kuleuven.be @ 2012-07-31  7:33 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54134
           Summary: ICE overriding derived type bound function with
                    allocatable character as result
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: koen.poppe@cs.kuleuven.be


Created attachment 27903
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27903
Code that reproduces the ICE with the correct output from two other compilers.

Consider the derived type A with no-pass type bound function which has an
allocatable character string as result. Now extend this type A with a type B
which overrides that function. The combination of this overriding and the fact
that the result is allocatable results in an ICE. Removing the inheritance from
A and/or changing the result type to a fixed length character string does not
trigger the ICE as shown in the attached example.


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

* [Bug fortran/54134] [OOP] ICE overriding derived type bound function with allocatable character as result
  2012-07-31  7:33 [Bug fortran/54134] New: ICE overriding derived type bound function with allocatable character as result koen.poppe at cs dot kuleuven.be
@ 2012-07-31  9:34 ` burnus at gcc dot gnu.org
  2012-07-31 10:13 ` janus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-07-31  9:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |janus at gcc dot gnu.org
            Summary|ICE overriding derived type |[OOP] ICE overriding
                   |bound function with         |derived type bound function
                   |allocatable character as    |with allocatable character
                   |result                      |as result

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-07-31 09:34:17 UTC ---
Backtrace:

#0  0x00000000005efd8b in gfc_dep_compare_expr (e1=0x0, e2=0x0) at
dependency.c:255
#1  0x0000000000586988 in gfc_check_typebound_override (proc=0x1620ef0,
old=0x16237b0) at interface.c:3895
#2  0x00000000005c4c00 in resolve_typebound_procedure (stree=0x1620ef0) at
resolve.c:11683


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

* [Bug fortran/54134] [OOP] ICE overriding derived type bound function with allocatable character as result
  2012-07-31  7:33 [Bug fortran/54134] New: ICE overriding derived type bound function with allocatable character as result koen.poppe at cs dot kuleuven.be
  2012-07-31  9:34 ` [Bug fortran/54134] [OOP] " burnus at gcc dot gnu.org
@ 2012-07-31 10:13 ` janus at gcc dot gnu.org
  2012-07-31 13:04 ` janus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2012-07-31 10:13 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-07-31
         AssignedTo|unassigned at gcc dot       |janus at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #2 from janus at gcc dot gnu.org 2012-07-31 10:13:29 UTC ---
Patch:

Index: gcc/fortran/dependency.c
===================================================================
--- gcc/fortran/dependency.c    (revision 189984)
+++ gcc/fortran/dependency.c    (working copy)
@@ -261,6 +261,9 @@ gfc_dep_compare_expr (gfc_expr *e1, gfc_expr *e2)
   n1 = NULL;
   n2 = NULL;

+  if (e1 == NULL && e2 == NULL)
+    return 0;
+
   /* Remove any integer conversion functions to larger types.  */
   if (e1->expr_type == EXPR_FUNCTION && e1->value.function.isym
       && e1->value.function.isym->id == GFC_ISYM_CONVERSION


With this, the test case compiles without error and produces the expected
result. Will commit as obvious after regtesting.


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

* [Bug fortran/54134] [OOP] ICE overriding derived type bound function with allocatable character as result
  2012-07-31  7:33 [Bug fortran/54134] New: ICE overriding derived type bound function with allocatable character as result koen.poppe at cs dot kuleuven.be
  2012-07-31  9:34 ` [Bug fortran/54134] [OOP] " burnus at gcc dot gnu.org
  2012-07-31 10:13 ` janus at gcc dot gnu.org
@ 2012-07-31 13:04 ` janus at gcc dot gnu.org
  2012-07-31 13:06 ` janus at gcc dot gnu.org
  2012-07-31 13:11 ` koen.poppe at cs dot kuleuven.be
  4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2012-07-31 13:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from janus at gcc dot gnu.org 2012-07-31 13:04:00 UTC ---
Author: janus
Date: Tue Jul 31 13:03:53 2012
New Revision: 190010

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

    PR fortran/54134
    * dependency.c (gfc_dep_compare_expr): Check if arguments are NULL.

2012-07-31  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/54134
    * gfortran.dg/typebound_override_3.f90: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/typebound_override_3.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/dependency.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/54134] [OOP] ICE overriding derived type bound function with allocatable character as result
  2012-07-31  7:33 [Bug fortran/54134] New: ICE overriding derived type bound function with allocatable character as result koen.poppe at cs dot kuleuven.be
                   ` (2 preceding siblings ...)
  2012-07-31 13:04 ` janus at gcc dot gnu.org
@ 2012-07-31 13:06 ` janus at gcc dot gnu.org
  2012-07-31 13:11 ` koen.poppe at cs dot kuleuven.be
  4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2012-07-31 13:06 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

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

--- Comment #4 from janus at gcc dot gnu.org 2012-07-31 13:05:40 UTC ---
Fixed on trunk with r190010. Closing.

Thanks for the report!


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

* [Bug fortran/54134] [OOP] ICE overriding derived type bound function with allocatable character as result
  2012-07-31  7:33 [Bug fortran/54134] New: ICE overriding derived type bound function with allocatable character as result koen.poppe at cs dot kuleuven.be
                   ` (3 preceding siblings ...)
  2012-07-31 13:06 ` janus at gcc dot gnu.org
@ 2012-07-31 13:11 ` koen.poppe at cs dot kuleuven.be
  4 siblings, 0 replies; 6+ messages in thread
From: koen.poppe at cs dot kuleuven.be @ 2012-07-31 13:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from koen.poppe at cs dot kuleuven.be 2012-07-31 13:10:46 UTC ---
Thank you for the quick response and solution!


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

end of thread, other threads:[~2012-07-31 13:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-31  7:33 [Bug fortran/54134] New: ICE overriding derived type bound function with allocatable character as result koen.poppe at cs dot kuleuven.be
2012-07-31  9:34 ` [Bug fortran/54134] [OOP] " burnus at gcc dot gnu.org
2012-07-31 10:13 ` janus at gcc dot gnu.org
2012-07-31 13:04 ` janus at gcc dot gnu.org
2012-07-31 13:06 ` janus at gcc dot gnu.org
2012-07-31 13:11 ` koen.poppe at cs dot kuleuven.be

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