public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57562] New: Internal compiler error due to extended derived type with PARAMETER attribute
@ 2013-06-07 19:21 helvio.vairinhos at gmail dot com
  2013-06-07 19:21 ` [Bug fortran/57562] " helvio.vairinhos at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: helvio.vairinhos at gmail dot com @ 2013-06-07 19:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57562
           Summary: Internal compiler error due to extended derived type
                    with PARAMETER attribute
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: helvio.vairinhos at gmail dot com

Created attachment 30277
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30277&action=edit
ICE example

Hi,

In programs like the example below:



program example

   type :: Parent
      integer :: member1 = 0
   end type Parent

   type, extends(Parent) :: Child
      integer :: member2 = 0
   end type Child

   integer, parameter :: member1 = 23
   integer, parameter :: member2 = 42

   type(Child), parameter :: object = Child(member1, member2)

   print *, object%member1  !<-- No ICE if commented out
   print *, object%member2

end program example



I get the following message (on versions 4.6.4 and 4.7.3):



f951: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.



Best regards,

Helvio


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

* [Bug fortran/57562] Internal compiler error due to extended derived type with PARAMETER attribute
  2013-06-07 19:21 [Bug fortran/57562] New: Internal compiler error due to extended derived type with PARAMETER attribute helvio.vairinhos at gmail dot com
@ 2013-06-07 19:21 ` helvio.vairinhos at gmail dot com
  2013-06-07 19:48 ` helvio.vairinhos at gmail dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: helvio.vairinhos at gmail dot com @ 2013-06-07 19:21 UTC (permalink / raw)
  To: gcc-bugs

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

helvio <helvio.vairinhos at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |major


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

* [Bug fortran/57562] Internal compiler error due to extended derived type with PARAMETER attribute
  2013-06-07 19:21 [Bug fortran/57562] New: Internal compiler error due to extended derived type with PARAMETER attribute helvio.vairinhos at gmail dot com
  2013-06-07 19:21 ` [Bug fortran/57562] " helvio.vairinhos at gmail dot com
@ 2013-06-07 19:48 ` helvio.vairinhos at gmail dot com
  2013-06-07 22:11 ` [Bug fortran/57562] [OOP] " burnus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: helvio.vairinhos at gmail dot com @ 2013-06-07 19:48 UTC (permalink / raw)
  To: gcc-bugs

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

helvio <helvio.vairinhos at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|4.7.3                       |4.8.1

--- Comment #1 from helvio <helvio.vairinhos at gmail dot com> ---
I just installed gfortran 4.8.1.
I tried to compile the example code, but the ICE still occurs.


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

* [Bug fortran/57562] [OOP] Internal compiler error due to extended derived type with PARAMETER attribute
  2013-06-07 19:21 [Bug fortran/57562] New: Internal compiler error due to extended derived type with PARAMETER attribute helvio.vairinhos at gmail dot com
  2013-06-07 19:21 ` [Bug fortran/57562] " helvio.vairinhos at gmail dot com
  2013-06-07 19:48 ` helvio.vairinhos at gmail dot com
@ 2013-06-07 22:11 ` burnus at gcc dot gnu.org
  2013-08-20 12:28 ` janus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-06-07 22:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org
            Summary|Internal compiler error due |[OOP] Internal compiler
                   |to extended derived type    |error due to extended
                   |with PARAMETER attribute    |derived type with PARAMETER
                   |                            |attribute
     Ever confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-06-07

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The problem seems to be that expr.c's find_component_ref is not prepared to
find the parent's elements as dt%comp instead of as dt%parent%comp.


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

* [Bug fortran/57562] [OOP] Internal compiler error due to extended derived type with PARAMETER attribute
  2013-06-07 19:21 [Bug fortran/57562] New: Internal compiler error due to extended derived type with PARAMETER attribute helvio.vairinhos at gmail dot com
                   ` (2 preceding siblings ...)
  2013-06-07 22:11 ` [Bug fortran/57562] [OOP] " burnus at gcc dot gnu.org
@ 2013-08-20 12:28 ` janus at gcc dot gnu.org
  2013-08-20 12:30 ` janus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-20 12:28 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |janus at gcc dot gnu.org

--- Comment #3 from janus at gcc dot gnu.org ---
Slightly reduced test case. Still fails with 4.9 trunk.


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

* [Bug fortran/57562] [OOP] Internal compiler error due to extended derived type with PARAMETER attribute
  2013-06-07 19:21 [Bug fortran/57562] New: Internal compiler error due to extended derived type with PARAMETER attribute helvio.vairinhos at gmail dot com
                   ` (3 preceding siblings ...)
  2013-08-20 12:28 ` janus at gcc dot gnu.org
@ 2013-08-20 12:30 ` janus at gcc dot gnu.org
  2014-12-31 17:11 ` [Bug fortran/57562] [OOP] ICE " janus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-20 12:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from janus at gcc dot gnu.org ---
(In reply to janus from comment #3)
> Slightly reduced test case.

... is here:


  type :: Parent
    integer :: member = 0
  end type

  type, extends(Parent) :: Child
  end type

  type(Child), parameter :: object = Child(23)

  print *, object%member

end


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

* [Bug fortran/57562] [OOP] ICE due to extended derived type with PARAMETER attribute
  2013-06-07 19:21 [Bug fortran/57562] New: Internal compiler error due to extended derived type with PARAMETER attribute helvio.vairinhos at gmail dot com
                   ` (4 preceding siblings ...)
  2013-08-20 12:30 ` janus at gcc dot gnu.org
@ 2014-12-31 17:11 ` janus at gcc dot gnu.org
  2014-12-31 18:11 ` janus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2014-12-31 17:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57562

--- Comment #5 from janus at gcc dot gnu.org ---
This patch fixes the ICE on comment 4, but not on comment 0, and regtests
cleanly:


Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c    (Revision 219126)
+++ gcc/fortran/expr.c    (Arbeitskopie)
@@ -1278,8 +1278,15 @@ find_component_ref (gfc_constructor_base base, gfc
   pick = ref->u.c.component;
   while (comp != pick)
     {
-      comp = comp->next;
-      c = gfc_constructor_next (c);
+      if (comp->next)
+      {
+    comp = comp->next;
+    c = gfc_constructor_next (c);
+      }
+      else if (comp->ts.type == BT_DERIVED)
+    comp = comp->ts.u.derived->components;
+      else
+    gcc_unreachable();
     }

   return c;


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

* [Bug fortran/57562] [OOP] ICE due to extended derived type with PARAMETER attribute
  2013-06-07 19:21 [Bug fortran/57562] New: Internal compiler error due to extended derived type with PARAMETER attribute helvio.vairinhos at gmail dot com
                   ` (5 preceding siblings ...)
  2014-12-31 17:11 ` [Bug fortran/57562] [OOP] ICE " janus at gcc dot gnu.org
@ 2014-12-31 18:11 ` janus at gcc dot gnu.org
  2015-01-02 11:08 ` janus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2014-12-31 18:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57562

--- Comment #6 from janus at gcc dot gnu.org ---
While trying to transform the example in comment 0 into a testsuite-suitable
form, I came across the following problem (with the patch in comment 5):

   type :: Parent
      integer :: member1 = 0
   end type

   type, extends(Parent) :: Child
      integer :: member2 = 0
   end type

   type(Child), parameter :: object = Child(23, 42)

   if (object%member1 /= 23) call abort
   if (object%member2 /= 42) call abort

end


    if (object%member1 /= 23) call abort
       1
Error: Operanden des Vergleichsoperators »/=« bei (1) sind
TYPE(parent)/INTEGER(4)

Just as the original example, it ICEs with 4.9.
>From gcc-bugs-return-472001-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Dec 31 18:51:49 2014
Return-Path: <gcc-bugs-return-472001-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 16954 invoked by alias); 31 Dec 2014 18:51:48 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 16929 invoked by uid 48); 31 Dec 2014 18:51:42 -0000
From: "rurban@x-ray.at" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/64459] New: __attribute__((returns_nonnull)) creates wrong code on amd64
Date: Wed, 31 Dec 2014 18:51:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.9.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rurban@x-ray.at
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-64459-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-12/txt/msg03008.txt.bz2
Content-length: 1026

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd459

            Bug ID: 64459
           Summary: __attribute__((returns_nonnull)) creates wrong code on
                    amd64
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rurban@x-ray.at

I had to disable the new returns_nonnull on parrot with gcc 4.9 on amd64,
but it does work fine with clang and the MSVC equivalent __notnull.
I tried the gcc optimizations O0 - O3.

The symptom is a double size in some io buffer, so it does not look related,
it's just some weird side-effect.
But it is.
The patch in question https://gcc.gnu.org/ml/gcc-patches/2013-10/msg00405.html
also looked innocent to me for the beginning.

Since we use 992 returns_nonnull annotated functions in parrot, the bisect
which function and asm exactly is the problem will need some time...

gcc (Debian 4.9.1-19) 4.9.1


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

* [Bug fortran/57562] [OOP] ICE due to extended derived type with PARAMETER attribute
  2013-06-07 19:21 [Bug fortran/57562] New: Internal compiler error due to extended derived type with PARAMETER attribute helvio.vairinhos at gmail dot com
                   ` (6 preceding siblings ...)
  2014-12-31 18:11 ` janus at gcc dot gnu.org
@ 2015-01-02 11:08 ` janus at gcc dot gnu.org
  2015-01-02 16:32 ` janus at gcc dot gnu.org
  2015-01-02 16:39 ` janus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2015-01-02 11:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57562

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |janus at gcc dot gnu.org

--- Comment #7 from janus at gcc dot gnu.org ---
The patch in comment 5 is far from complete. Here is a new version, which
should be much better. It regtests cleanly and works with all three variants of
the test case in this PR.


Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c    (Revision 219140)
+++ gcc/fortran/expr.c    (Arbeitskopie)
@@ -1270,12 +1270,23 @@ depart:
 static gfc_constructor *
 find_component_ref (gfc_constructor_base base, gfc_ref *ref)
 {
-  gfc_component *comp;
-  gfc_component *pick;
+  gfc_component *pick = ref->u.c.component;
   gfc_constructor *c = gfc_constructor_first (base);

-  comp = ref->u.c.sym->components;
-  pick = ref->u.c.component;
+  gfc_symbol *dt = ref->u.c.sym;
+  int ext = dt->attr.extension;
+
+  /* For extended types, check if the desired component is in one of the
+   * parent types.  */
+  while (ext>0 && gfc_find_component (dt->components->ts.u.derived,
pick->name,
+                      true, true))
+    {
+      dt = dt->components->ts.u.derived;
+      c = gfc_constructor_first (c->expr->value.constructor);
+      ext--;
+    }
+
+  gfc_component *comp = dt->components;
   while (comp != pick)
     {
       comp = comp->next;


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

* [Bug fortran/57562] [OOP] ICE due to extended derived type with PARAMETER attribute
  2013-06-07 19:21 [Bug fortran/57562] New: Internal compiler error due to extended derived type with PARAMETER attribute helvio.vairinhos at gmail dot com
                   ` (7 preceding siblings ...)
  2015-01-02 11:08 ` janus at gcc dot gnu.org
@ 2015-01-02 16:32 ` janus at gcc dot gnu.org
  2015-01-02 16:39 ` janus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2015-01-02 16:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57562

--- Comment #8 from janus at gcc dot gnu.org ---
Author: janus
Date: Fri Jan  2 16:31:52 2015
New Revision: 219144

URL: https://gcc.gnu.org/viewcvs?rev=219144&root=gcc&view=rev
Log:
2015-01-02  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/57562
    * expr.c (find_component_ref): Deal with extended types.

2015-01-02  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/57562
    * gfortran.dg/extends_16.f90: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/extends_16.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/57562] [OOP] ICE due to extended derived type with PARAMETER attribute
  2013-06-07 19:21 [Bug fortran/57562] New: Internal compiler error due to extended derived type with PARAMETER attribute helvio.vairinhos at gmail dot com
                   ` (8 preceding siblings ...)
  2015-01-02 16:32 ` janus at gcc dot gnu.org
@ 2015-01-02 16:39 ` janus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2015-01-02 16:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57562

janus at gcc dot gnu.org changed:

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

--- Comment #9 from janus at gcc dot gnu.org ---
Fixed on trunk with r219144. Closing.

Thanks for the report!


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

end of thread, other threads:[~2015-01-02 16:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-07 19:21 [Bug fortran/57562] New: Internal compiler error due to extended derived type with PARAMETER attribute helvio.vairinhos at gmail dot com
2013-06-07 19:21 ` [Bug fortran/57562] " helvio.vairinhos at gmail dot com
2013-06-07 19:48 ` helvio.vairinhos at gmail dot com
2013-06-07 22:11 ` [Bug fortran/57562] [OOP] " burnus at gcc dot gnu.org
2013-08-20 12:28 ` janus at gcc dot gnu.org
2013-08-20 12:30 ` janus at gcc dot gnu.org
2014-12-31 17:11 ` [Bug fortran/57562] [OOP] ICE " janus at gcc dot gnu.org
2014-12-31 18:11 ` janus at gcc dot gnu.org
2015-01-02 11:08 ` janus at gcc dot gnu.org
2015-01-02 16:32 ` janus at gcc dot gnu.org
2015-01-02 16:39 ` 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).