Bug 25776 - [4.2 Regression] ICE in cgraph after error at -O1 and above
Summary: [4.2 Regression] ICE in cgraph after error at -O1 and above
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.2.0
Assignee: Andrew Pinski
URL:
Keywords: error-recovery, ice-on-invalid-code, ice-on-valid-code, monitored
: 26281 26979 27207 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-01-12 21:04 UTC by Andrew Pinski
Modified: 2006-05-20 22:35 UTC (History)
7 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-03-06 15:04:18


Attachments
fix typo in errormessage in verify_cgraph_node() (276 bytes, patch)
2006-04-25 17:00 UTC, Bernhard Reutner-Fischer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2006-01-12 21:04:22 UTC
C++ testcase:
namespace std {
  template<typename _Tp>     struct allocator     {
  };
}
namespace __gnu_cxx {
}
namespace std {
  template<typename _CharT, typename _Traits, typename _Alloc>     class basic_string   {
  };
  template<typename _Tp, typename _Alloc>     struct _Vector_base     {
    struct _Vector_impl       : public _Tp_alloc_type       {
    };
    ~_Vector_base()       {
    }
  };
  template<typename _Tp, typename _Alloc = std::allocator<_Tp> >     class vector : protected _Vector_base<_Tp, _Alloc>     {
  };
struct surface_restorer {
};
namespace events {
  struct handler {
    virtual ~handler();
  };
  struct widget : public events::handler {
    std::vector< surface_restorer > restorer_;
  };
  struct scrollbar : public widget {
  };
  scrollbar a;
Comment 1 Andrew Pinski 2006-01-16 06:24:48 UTC
The ICE is:
t.cc:33: error: inlined_to pointer is set but no predecesors found
virtual std::events::scrollbar::~scrollbar()/33: (inline copy in void __static_initialization_and_destruction_0(int, int)/11) availability:available(9) 35 insns (89 after inlining) tree externally_visible finalized inlinable
  called by: 
  calls: std::events::widget::~widget()/4 (inlined) void operator delete(void*)/26 
t.cc:33: internal compiler error: verify_cgraph_node failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


It seems wrong that we are running the inliner when we have errors.
Comment 2 Volker Reichelt 2006-01-19 15:57:30 UTC
Confirmed. Reduced testcase:

=======================
struct A
{
  ERROR;
  ~A();
};

struct B
{
  virtual ~B();
};

struct C : B, A {};

struct D : C {};

D d;
=======================
Comment 3 Andrew Pinski 2006-02-14 12:49:10 UTC
*** Bug 26281 has been marked as a duplicate of this bug. ***
Comment 4 Andrew Pinski 2006-04-02 05:36:12 UTC
*** Bug 26979 has been marked as a duplicate of this bug. ***
Comment 5 Andrew Pinski 2006-04-19 03:02:25 UTC
*** Bug 27207 has been marked as a duplicate of this bug. ***
Comment 6 Andrew Pinski 2006-04-19 03:03:32 UTC
This also can ICE with valid code with -Werror and a warning was emitted, PR 27207 was that case.
Comment 7 Andrew Pinski 2006-04-24 00:38:20 UTC
here is the fix I came up with:
Index: cgraphunit.c
===================================================================
--- cgraphunit.c        (revision 113199)
+++ cgraphunit.c        (working copy)
@@ -1404,7 +1404,8 @@ cgraph_optimize (void)
       fprintf (cgraph_dump_file, "Marked ");
       dump_cgraph (cgraph_dump_file);
     }
-  ipa_passes ();
+  if (errorcount == 0 && sorrycount == 0)
+    ipa_passes ();
   /* This pass remove bodies of extern inline functions we never inlined.
      Do this later so other IPA passes see what is really going on.  */
   cgraph_remove_unreachable_nodes (false, dump_file);
Comment 8 Bernhard Reutner-Fischer 2006-04-25 17:00:42 UTC
Created attachment 11334 [details]
fix typo in errormessage in verify_cgraph_node()

Just as a sidenote.. There is a typo in the error message in comment #1. The attached patch fixes this on the 4.1 branch and on trunk.

Please apply, TIA.

2006-04-25  Bernhard Fischer  <aldot@gcc.gnu.org>

        * cgraphunit.c (verify_cgraph_node): Fix typo s/predecesors/predecessors/
        in error message.
Comment 9 Jan Hubicka 2006-04-30 13:27:33 UTC
Both patches (comment #7 and comment #8) are OK assuming they pass testing (that is rather obvious).

Thanks,
Honza
Comment 10 Andrew Pinski 2006-05-05 08:11:02 UTC
Mine.
Comment 11 Martin Michlmayr 2006-05-18 09:34:15 UTC
(In reply to comment #10)
> Mine.

Did you resolve your copyright problems?


Comment 12 Andrew Pinski 2006-05-20 20:20:26 UTC
(In reply to comment #11)
> Did you resolve your copyright problems?

No but this patch is small enough not to need a copyright assignment so I am going to commit it now.
Comment 13 Andrew Pinski 2006-05-20 22:35:10 UTC
Fixed.
Comment 14 Andrew Pinski 2006-05-20 22:35:20 UTC
Subject: Bug 25776

Author: pinskia
Date: Sat May 20 22:35:02 2006
New Revision: 113941

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113941
Log:
2006-05-20  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/25776
        * cgraphunit.c (cgraph_optimize): Don't run ipa passes if error
        or sorry count is non zero.

2006-05-20  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/25776
        * g++.dg/other/error11.C: New test. 



Added:
    trunk/gcc/testsuite/g++.dg/other/error11.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraphunit.c
    trunk/gcc/testsuite/ChangeLog

Comment 15 Bernhard Reutner-Fischer 2006-05-21 13:10:45 UTC
Subject: Bug 25776

Author: aldot
Date: Sun May 21 13:10:37 2006
New Revision: 113952

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113952
Log:
ACKed by Jan Hubicka in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25776#c9

	PR middle-end/25776
	* cgraphunit.c (verify_cgraph_node): Typo in error message.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraphunit.c