public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/28058]  New: [4.1/4.2 regression] ICE in inline_forbidden_p
@ 2006-06-16 13:08 jakub at gcc dot gnu dot org
  2006-06-16 13:49 ` [Bug tree-optimization/28058] " jakub at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-06-16 13:08 UTC (permalink / raw)
  To: gcc-bugs

struct A {};

template <class T>
struct B : public T
{
  B ();
};

B<A> *
foo ()
{
  return new B<A>();
}

template <class T>
B<T>::B ()
{
}

template <>
B<A>::B ()
{
}

ICEs at -O3 i inline_forbidden_p:
1448      FOR_EACH_BB_FN (bb, DECL_STRUCT_FUNCTION (fndecl))
as fndecl (B ctor) doesn't have cfg set (DECL_STRUCT_FUNCTION (fndecl)->cfg ==
NULL).


-- 
           Summary: [4.1/4.2 regression] ICE in inline_forbidden_p
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


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

* [Bug tree-optimization/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
@ 2006-06-16 13:49 ` jakub at gcc dot gnu dot org
  2006-06-16 18:02 ` [Bug c++/28058] " pinskia at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-06-16 13:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2006-06-16 13:47 -------
The problem seems to be that cp_cannot_inline_tree_fn changes *fnp to
whatever instantiate_decl returned and that function has not been lowered yet.
Not sure if it is at all possible to cgraph_lower_function from within
inlinable_function_p (i.e. if cgraph_analyze_function is reentrant) and if yes,
if that's supposed to be cp_cannot_inline_tree_fn's responsibility.
In any case, the testcase works if foo is moved to the end of the file, at
which
point the template is already lowered.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
  2006-06-16 13:49 ` [Bug tree-optimization/28058] " jakub at gcc dot gnu dot org
@ 2006-06-16 18:02 ` pinskia at gcc dot gnu dot org
  2006-06-16 22:55 ` bangerth at dealii dot org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-16 18:02 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |c++
   Target Milestone|---                         |4.1.2


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


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

* [Bug c++/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
  2006-06-16 13:49 ` [Bug tree-optimization/28058] " jakub at gcc dot gnu dot org
  2006-06-16 18:02 ` [Bug c++/28058] " pinskia at gcc dot gnu dot org
@ 2006-06-16 22:55 ` bangerth at dealii dot org
  2006-06-16 22:57 ` bangerth at dealii dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bangerth at dealii dot org @ 2006-06-16 22:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bangerth at dealii dot org  2006-06-16 22:51 -------
Confirmed.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-06-16 22:51:36
               date|                            |


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


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

* [Bug c++/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-06-16 22:55 ` bangerth at dealii dot org
@ 2006-06-16 22:57 ` bangerth at dealii dot org
  2006-06-25  5:31 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bangerth at dealii dot org @ 2006-06-16 22:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from bangerth at dealii dot org  2006-06-16 22:55 -------
The code is invalid, however: explicit specializations must be declared
before they are first used. In the snippet, B<A>::B is used in foo()
before the specialization is declared. The ICE consequently also goes
away if a declaration (not definition) of the specialization precedes foo().

That all doesn't make it any more forgivable that we ICE on this code,
however.

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code


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


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

* [Bug c++/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-06-16 22:57 ` bangerth at dealii dot org
@ 2006-06-25  5:31 ` pinskia at gcc dot gnu dot org
  2006-07-12 16:39 ` reichelt at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-25  5:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-06-24 23:53 -------
*** Bug 28159 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vapier at gentoo dot org


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


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

* [Bug c++/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-06-25  5:31 ` pinskia at gcc dot gnu dot org
@ 2006-07-12 16:39 ` reichelt at gcc dot gnu dot org
  2006-07-17  2:43 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-07-12 16:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from reichelt at gcc dot gnu dot org  2006-07-12 16:39 -------
Here's a testcase that crashes even at -O0 since GCC 4.1.0:

===========================
template<int> struct A
{
    A() {}
};

A<0> a;

template<> A<0>::A() {}
===========================

As Wolfgang already mentioned: explicit specializations must be declared
before they are first used.
However, no diagnostic is required. (Which indicates that such situations
are hard to detect reliably.)


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org


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


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

* [Bug c++/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2006-07-12 16:39 ` reichelt at gcc dot gnu dot org
@ 2006-07-17  2:43 ` mmitchel at gcc dot gnu dot org
  2006-07-21 20:36 ` hubicka at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-07-17  2:43 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug c++/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2006-07-17  2:43 ` mmitchel at gcc dot gnu dot org
@ 2006-07-21 20:36 ` hubicka at gcc dot gnu dot org
  2006-08-14 16:17 ` janis at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2006-07-21 20:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from hubicka at gcc dot gnu dot org  2006-07-21 20:36 -------
cgraph_analyze_function is reentrant for non-unit-at-a-time support.  However
with unit-at-a-time, the analysis happens only after unit has been finalized
and at that time frontend is not supposed to come up with new functions
anymore.  It would be a lot better to make C++ frontend to handle this case
early (probably diagnose the invalid code?), but I don't quite understand this
area of compiler, so if someone C++ aware would tell me it is dificult, we can
do it as workaround.

Honza


-- 


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


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

* [Bug c++/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2006-07-21 20:36 ` hubicka at gcc dot gnu dot org
@ 2006-08-14 16:17 ` janis at gcc dot gnu dot org
  2006-08-26 16:48 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: janis at gcc dot gnu dot org @ 2006-08-14 16:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from janis at gcc dot gnu dot org  2006-08-14 16:16 -------
Regression hunts on powerpc-linux showed that the original testcase with -O3
and the testcase in comment #5 with -O0 both start getting segfaults with the
following patch:

    http://gcc.gnu.org/viewcvs?view=rev&rev=99840

    r99840 | hubicka | 2005-05-17 16:56:32 +0000 (Tue, 17 May 2005)


-- 


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


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

* [Bug c++/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2006-08-14 16:17 ` janis at gcc dot gnu dot org
@ 2006-08-26 16:48 ` mmitchel at gcc dot gnu dot org
  2006-08-26 16:54 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-08-26 16:48 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2006-08-26 16:48 ` mmitchel at gcc dot gnu dot org
@ 2006-08-26 16:54 ` mmitchel at gcc dot gnu dot org
  2006-08-27 17:45 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-08-26 16:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from mmitchel at gcc dot gnu dot org  2006-08-26 16:53 -------
We do have code to notice use-before-specialization errors.  For example:

  template <typename T> void f();
  void g() {
    f<int>();
  }
  template <> void f<int>() {}

results in an error.

However, the code to initialize static variables is not generated until
end-of-file, so we do not realize that we are in this situation.  (See
expand_static_init for the point at which we defer initialization.)


-- 


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


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

* [Bug c++/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2006-08-26 16:54 ` mmitchel at gcc dot gnu dot org
@ 2006-08-27 17:45 ` mmitchel at gcc dot gnu dot org
  2006-08-27 18:00 ` mmitchel at gcc dot gnu dot org
  2006-08-27 18:01 ` mmitchel at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-08-27 17:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from mmitchel at gcc dot gnu dot org  2006-08-27 17:45 -------
Subject: Bug 28058

Author: mmitchel
Date: Sun Aug 27 17:45:25 2006
New Revision: 116491

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116491
Log:
        PR c++/28058
        * pt.c (register_specialization): Return error_mark_node for
        specialization-after-instantiation.
        * decl2.c (mark_used): Mark the main function used when one of its
        clones is used.

        PR c++/28058
        * g++.dg/template/spec31.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/template/spec31.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2006-08-27 17:45 ` mmitchel at gcc dot gnu dot org
@ 2006-08-27 18:00 ` mmitchel at gcc dot gnu dot org
  2006-08-27 18:01 ` mmitchel at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-08-27 18:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from mmitchel at gcc dot gnu dot org  2006-08-27 18:00 -------
Subject: Bug 28058

Author: mmitchel
Date: Sun Aug 27 17:59:55 2006
New Revision: 116492

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116492
Log:
        PR c++/28058
        * pt.c (register_specialization): Return error_mark_node for
        specialization-after-instantiation.
        * decl2.c (mark_used): Mark the main function used when one of its
        clones is used.

        PR c++/28058
        * g++.dg/template/spec31.C: New test.
        * g++.old-deja/g++.pt/spec9.C: Adjust error markers.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/spec31.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/decl2.c
    branches/gcc-4_1-branch/gcc/cp/pt.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/g++.old-deja/g++.pt/spec9.C


-- 


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


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

* [Bug c++/28058] [4.1/4.2 regression] ICE in inline_forbidden_p
  2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2006-08-27 18:00 ` mmitchel at gcc dot gnu dot org
@ 2006-08-27 18:01 ` mmitchel at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-08-27 18:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from mmitchel at gcc dot gnu dot org  2006-08-27 18:00 -------
Fixed in 4.1.2.


-- 

mmitchel at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-08-27 18:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-16 13:08 [Bug tree-optimization/28058] New: [4.1/4.2 regression] ICE in inline_forbidden_p jakub at gcc dot gnu dot org
2006-06-16 13:49 ` [Bug tree-optimization/28058] " jakub at gcc dot gnu dot org
2006-06-16 18:02 ` [Bug c++/28058] " pinskia at gcc dot gnu dot org
2006-06-16 22:55 ` bangerth at dealii dot org
2006-06-16 22:57 ` bangerth at dealii dot org
2006-06-25  5:31 ` pinskia at gcc dot gnu dot org
2006-07-12 16:39 ` reichelt at gcc dot gnu dot org
2006-07-17  2:43 ` mmitchel at gcc dot gnu dot org
2006-07-21 20:36 ` hubicka at gcc dot gnu dot org
2006-08-14 16:17 ` janis at gcc dot gnu dot org
2006-08-26 16:48 ` mmitchel at gcc dot gnu dot org
2006-08-26 16:54 ` mmitchel at gcc dot gnu dot org
2006-08-27 17:45 ` mmitchel at gcc dot gnu dot org
2006-08-27 18:00 ` mmitchel at gcc dot gnu dot org
2006-08-27 18:01 ` mmitchel at gcc dot gnu dot 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).