public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58300] New: ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code
@ 2013-09-02 20:01 zsojka at seznam dot cz
  2013-09-03  6:36 ` [Bug c++/58300] " mpolacek at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2013-09-02 20:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58300
           Summary: ICE: in decide_is_symbol_needed, at cgraphunit.c:233
                    with -fvtable-verify=preinit on invalid code
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz

Created attachment 30742
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30742&action=edit
reduced testcase

Compiler output:
$ gcc -fvtable-verify=preinit testcase.C 
testcase.C:2:1: error: explicit specialization of non-template 'A'
 {
 ^
testcase.C:4:2: internal compiler error: in decide_is_symbol_needed, at
cgraphunit.c:233
 };
  ^
0x887ed8 decide_is_symbol_needed(symtab_node_def*)
        /mnt/svn/gcc-trunk/gcc/cgraphunit.c:232
0x888468 cgraph_finalize_function(tree_node*, bool)
        /mnt/svn/gcc-trunk/gcc/cgraphunit.c:459
0x889f69 cgraph_process_new_functions()
        /mnt/svn/gcc-trunk/gcc/cgraphunit.c:306
0x79d756 vtv_generate_init_routine()
        /mnt/svn/gcc-trunk/gcc/cp/vtable-class-hierarchy.c:1190
0x68fc46 cp_write_global_declarations()
        /mnt/svn/gcc-trunk/gcc/cp/decl2.c:4373
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


$ gcc -v                                 
Using built-in specs.
COLLECT_GCC=/mnt/svn/gcc-trunk/binary-latest/bin/gcc
COLLECT_LTO_WRAPPER=/mnt/svn/gcc-trunk/binary-202158-lto-fortran-checking-yes-rtl-df/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /mnt/svn/gcc-trunk//configure --enable-checking=yes,rtl,df
--enable-languages=c,c++,lto,fortran
--prefix=/mnt/svn/gcc-trunk/binary-202158-lto-fortran-checking-yes-rtl-df/
--without-cloog --without-ppl
Thread model: posix
gcc version 4.9.0 20130902 (experimental) (GCC)


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

* [Bug c++/58300] ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code
  2013-09-02 20:01 [Bug c++/58300] New: ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code zsojka at seznam dot cz
@ 2013-09-03  6:36 ` mpolacek at gcc dot gnu.org
  2013-09-03  6:55 ` mpolacek at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-03  6:36 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-09-03
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.9.0
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.


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

* [Bug c++/58300] ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code
  2013-09-02 20:01 [Bug c++/58300] New: ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code zsojka at seznam dot cz
  2013-09-03  6:36 ` [Bug c++/58300] " mpolacek at gcc dot gnu.org
@ 2013-09-03  6:55 ` mpolacek at gcc dot gnu.org
  2013-09-03  7:01 ` mpolacek at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-03  6:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with VTV merge: r201555.


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

* [Bug c++/58300] ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code
  2013-09-02 20:01 [Bug c++/58300] New: ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code zsojka at seznam dot cz
  2013-09-03  6:36 ` [Bug c++/58300] " mpolacek at gcc dot gnu.org
  2013-09-03  6:55 ` mpolacek at gcc dot gnu.org
@ 2013-09-03  7:01 ` mpolacek at gcc dot gnu.org
  2013-09-03 22:25 ` cmtice at google dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-03  7:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
decide_is_symbol_needed has
  /* Double check that no one output the function into assembly file early.  */
but it gets
 <function_decl 0x7fedaeb5f500 _GLOBAL__sub_I.00099_vt.C
    type <function_type 0x7fedaea12bd0
        type <void_type 0x7fedaea02bd0 void VOID
            align 8 symtab 0 alias set -1 canonical type 0x7fedaea02bd0
            pointer_to_this <pointer_type 0x7fedaea02c78>>
        QI
        size <integer_cst 0x7fedaea04180 constant 8>
        unit size <integer_cst 0x7fedaea041a0 constant 1>
        align 8 symtab 0 alias set -1 canonical type 0x7fedaea12bd0
        arg-types <tree_list 0x7fedae9f5b18 value <void_type 0x7fedaea02bd0
void>>>
    used nothrow static preserve decl_5 QI file vt.C line 4 col 2 align 8
initial <block 0x7fedaeb67050>
    result <result_decl 0x7fedaeb64000 D.2221 type <void_type 0x7fedaea02bd0
void>
        ignored VOID file vt.C line 4 col 2
        align 8 context <function_decl 0x7fedaeb5f500
_GLOBAL__sub_I.00099_vt.C>>
    full-name "(static initializers for vt.C)"
    pending-inline-info 0x7fedaeb60480
    (mem:QI (symbol_ref:DI ("_GLOBAL__sub_I.00099_vt.C") [flags 0x3]
<function_decl 0x7fedaeb5f500 _GLOBAL__sub_I.00099_vt.C>) [0 S1 A8])
    struct-function 0x7fedae9f7140>


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

* [Bug c++/58300] ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code
  2013-09-02 20:01 [Bug c++/58300] New: ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2013-09-03  7:01 ` mpolacek at gcc dot gnu.org
@ 2013-09-03 22:25 ` cmtice at google dot com
  2013-09-05 14:16 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cmtice at google dot com @ 2013-09-03 22:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Caroline Tice <cmtice at google dot com> ---
I am looking into this now.  I will update this bug when I know more.


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

* [Bug c++/58300] ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code
  2013-09-02 20:01 [Bug c++/58300] New: ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2013-09-03 22:25 ` cmtice at google dot com
@ 2013-09-05 14:16 ` paolo.carlini at oracle dot com
  2013-09-05 22:17 ` cmtice at google dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-05 14:16 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|cmtice at google dot com           |
           Assignee|unassigned at gcc dot gnu.org      |cmtice at google dot com

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Thanks!


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

* [Bug c++/58300] ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code
  2013-09-02 20:01 [Bug c++/58300] New: ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2013-09-05 14:16 ` paolo.carlini at oracle dot com
@ 2013-09-05 22:17 ` cmtice at google dot com
  2013-09-05 22:38 ` cmtice at google dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cmtice at google dot com @ 2013-09-05 22:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Caroline Tice <cmtice at google dot com> ---
When the preinit flag is used, the vtable verification constructor
initialization function was getting written to the assembly file before
cgraph_process_new_functions was being called (to process the new function),
which was causing an assertion failure in decide_is_symbol_needed (which
expects the symbol NOT to have its decl assembler name yet).  The fix is very
simple...reorder those two events.  This should not cause any errors.  I have a
patch that does this, which I have tested both on this test case and with the
new libvtv testsuite, and it passes in both places:

Index: gcc/cp/vtable-class-hierarchy.c
===================================================================
--- vtable-class-hierarchy.c    (revision 202296)
+++ vtable-class-hierarchy.c    (working copy)
@@ -1179,15 +1179,16 @@ vtv_generate_init_routine (void)
       TREE_USED (vtv_fndecl) = 1;
       DECL_PRESERVE_P (vtv_fndecl) = 1;
       if (flag_vtable_verify == VTV_PREINIT_PRIORITY)
-        {
-          DECL_STATIC_CONSTRUCTOR (vtv_fndecl) = 0;
-          assemble_vtv_preinit_initializer (vtv_fndecl);
-        }
+        DECL_STATIC_CONSTRUCTOR (vtv_fndecl) = 0;

       gimplify_function_tree (vtv_fndecl);
       cgraph_add_new_function (vtv_fndecl, false);

       cgraph_process_new_functions ();
+
+      if (flag_vtable_verify == VTV_PREINIT_PRIORITY)
+        assemble_vtv_preinit_initializer (vtv_fndecl);
+
     }
   pop_lang_context ();
 }


I will submit this patch for review soon.


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

* [Bug c++/58300] ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code
  2013-09-02 20:01 [Bug c++/58300] New: ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2013-09-05 22:17 ` cmtice at google dot com
@ 2013-09-05 22:38 ` cmtice at google dot com
  2013-09-05 22:39 ` cmtice at google dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cmtice at google dot com @ 2013-09-05 22:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Caroline Tice <cmtice at google dot com> ---
Created attachment 30752
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30752&action=edit
Reorder two function calls to prevent an ICE.


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

* [Bug c++/58300] ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code
  2013-09-02 20:01 [Bug c++/58300] New: ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2013-09-05 22:38 ` cmtice at google dot com
@ 2013-09-05 22:39 ` cmtice at google dot com
  2013-09-08 21:58 ` ctice at gcc dot gnu.org
  2013-09-08 22:01 ` cmtice at google dot com
  9 siblings, 0 replies; 11+ messages in thread
From: cmtice at google dot com @ 2013-09-05 22:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Caroline Tice <cmtice at google dot com> ---
I have added the patch as an attachment, and also submitted it to the
gcc-patches list for review.


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

* [Bug c++/58300] ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code
  2013-09-02 20:01 [Bug c++/58300] New: ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code zsojka at seznam dot cz
                   ` (7 preceding siblings ...)
  2013-09-05 22:39 ` cmtice at google dot com
@ 2013-09-08 21:58 ` ctice at gcc dot gnu.org
  2013-09-08 22:01 ` cmtice at google dot com
  9 siblings, 0 replies; 11+ messages in thread
From: ctice at gcc dot gnu.org @ 2013-09-08 21:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from ctice at gcc dot gnu.org ---
Author: ctice
Date: Sun Sep  8 21:58:07 2013
New Revision: 202371

URL: http://gcc.gnu.org/viewcvs?rev=202371&root=gcc&view=rev
Log:

Fix PR 58300:  Re-order events with -fvtable-verify=preinit
flag, so constructor init function is  not written to assembly
file until after call to cgraph_process_new_functions.


Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/vtable-class-hierarchy.c


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

* [Bug c++/58300] ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code
  2013-09-02 20:01 [Bug c++/58300] New: ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code zsojka at seznam dot cz
                   ` (8 preceding siblings ...)
  2013-09-08 21:58 ` ctice at gcc dot gnu.org
@ 2013-09-08 22:01 ` cmtice at google dot com
  9 siblings, 0 replies; 11+ messages in thread
From: cmtice at google dot com @ 2013-09-08 22:01 UTC (permalink / raw)
  To: gcc-bugs

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

Caroline Tice <cmtice at google dot com> changed:

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

--- Comment #10 from Caroline Tice <cmtice at google dot com> ---
See other comments.


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

end of thread, other threads:[~2013-09-08 22:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-02 20:01 [Bug c++/58300] New: ICE: in decide_is_symbol_needed, at cgraphunit.c:233 with -fvtable-verify=preinit on invalid code zsojka at seznam dot cz
2013-09-03  6:36 ` [Bug c++/58300] " mpolacek at gcc dot gnu.org
2013-09-03  6:55 ` mpolacek at gcc dot gnu.org
2013-09-03  7:01 ` mpolacek at gcc dot gnu.org
2013-09-03 22:25 ` cmtice at google dot com
2013-09-05 14:16 ` paolo.carlini at oracle dot com
2013-09-05 22:17 ` cmtice at google dot com
2013-09-05 22:38 ` cmtice at google dot com
2013-09-05 22:39 ` cmtice at google dot com
2013-09-08 21:58 ` ctice at gcc dot gnu.org
2013-09-08 22:01 ` cmtice at google dot com

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