public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/60002] New: ICE: SIGSEGV in skip_artificial_parms_for() with -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone
@ 2014-01-30 22:12 zsojka at seznam dot cz
  2014-01-31 13:38 ` [Bug tree-optimization/60002] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: zsojka at seznam dot cz @ 2014-01-30 22:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60002
           Summary: ICE: SIGSEGV in skip_artificial_parms_for() with -O2
                    -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz

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

Compiler output:
$ gcc -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone testcase.C
==2803== Invalid read of size 2
==2803==    at 0x7A87C0: skip_artificial_parms_for(tree_node const*,
tree_node*) (tree.h:2822)
==2803==    by 0x7282E0: dump_function_decl(cxx_pretty_printer*, tree_node*,
int) (error.c:1453)
==2803==    by 0x72A1A5: decl_as_string(tree_node*, int) (error.c:2732)
==2803==    by 0x7DD572: cxx_printable_name_internal(tree_node*, int, bool)
(tree.c:1979)
==2803==    by 0xD2815E: dump_enumerated_decls(_IO_FILE*, int) (tree-dfa.c:760)
==2803==    by 0xD201CC: (anonymous
namespace)::pass_cleanup_cfg_post_optimizing::execute()
(tree-cfgcleanup.c:1079)
==2803==    by 0xBF3B09: execute_one_pass(opt_pass*) (passes.c:2229)
==2803==    by 0xBF3DA5: execute_pass_list(opt_pass*) (passes.c:2282)
==2803==    by 0x931C98: expand_function(cgraph_node*) (cgraphunit.c:1764)
==2803==    by 0x933BEB: compile() (cgraphunit.c:1898)
==2803==    by 0x9343F4: finalize_compilation_unit() (cgraphunit.c:2319)
==2803==    by 0x71C20E: cp_write_global_declarations() (decl2.c:4431)
==2803==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==2803== 
==2803== Invalid read of size 2
==2803==    at 0x7A87C0: skip_artificial_parms_for(tree_node const*,
tree_node*) (tree.h:2822)
==2803==    by 0x7282E0: dump_function_decl(cxx_pretty_printer*, tree_node*,
int) (error.c:1453)
==2803==    by 0x72A20E: decl_as_string_translate(tree_node*, int)
(error.c:2740)
==2803==    by 0x7DD572: cxx_printable_name_internal(tree_node*, int, bool)
(tree.c:1979)
==2803==    by 0x729872: cp_diagnostic_starter(diagnostic_context*,
diagnostic_info*) (error.c:3081)
==2803==    by 0x15BB688: diagnostic_report_diagnostic(diagnostic_context*,
diagnostic_info*) (diagnostic.c:798)
==2803==    by 0x15BC3EF: internal_error(char const*, ...) (diagnostic.c:1136)
==2803==    by 0xCE85CF: crash_signal(int) (toplev.c:337)
==2803==    by 0x5A592DF: ??? (in /lib64/libc-2.17.so)
==2803==    by 0x7A87BF: skip_artificial_parms_for(tree_node const*,
tree_node*) (method.c:2013)
==2803==    by 0x7282E0: dump_function_decl(cxx_pretty_printer*, tree_node*,
int) (error.c:1453)
==2803==    by 0x72A1A5: decl_as_string(tree_node*, int) (error.c:2732)
==2803==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==2803== 
==2803== 
==2803== Process terminating with default action of signal 11 (SIGSEGV)
==2803==  Access not within mapped region at address 0x0
==2803==    at 0x7A87C0: skip_artificial_parms_for(tree_node const*,
tree_node*) (tree.h:2822)
==2803==    by 0x7282E0: dump_function_decl(cxx_pretty_printer*, tree_node*,
int) (error.c:1453)
==2803==    by 0x72A20E: decl_as_string_translate(tree_node*, int)
(error.c:2740)
==2803==    by 0x7DD572: cxx_printable_name_internal(tree_node*, int, bool)
(tree.c:1979)
==2803==    by 0x729872: cp_diagnostic_starter(diagnostic_context*,
diagnostic_info*) (error.c:3081)
==2803==    by 0x15BB688: diagnostic_report_diagnostic(diagnostic_context*,
diagnostic_info*) (diagnostic.c:798)
==2803==    by 0x15BC3EF: internal_error(char const*, ...) (diagnostic.c:1136)
==2803==    by 0xCE85CF: crash_signal(int) (toplev.c:337)
==2803==    by 0x5A592DF: ??? (in /lib64/libc-2.17.so)
==2803==    by 0x7A87BF: skip_artificial_parms_for(tree_node const*,
tree_node*) (method.c:2013)
==2803==    by 0x7282E0: dump_function_decl(cxx_pretty_printer*, tree_node*,
int) (error.c:1453)
==2803==    by 0x72A1A5: decl_as_string(tree_node*, int) (error.c:2732)
==2803==  If you believe this happened as a result of a stack
==2803==  overflow in your program's main thread (unlikely but
==2803==  possible), you can try to increase the size of the
==2803==  main thread stack using the --main-stacksize= flag.
==2803==  The main thread stack size used in this run was 16777216.
gcc: internal compiler error: Segmentation fault (program valgrind)
0x40d36e execute
        /mnt/svn/gcc-trunk/gcc/gcc.c:2841
0x40d5e9 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:4641
0x410351 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:5924
0x410351 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:5838
0x40dd62 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5295
0x410351 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:5924
0x410351 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:5838
0x40dd62 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5295
0x40d95e do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5410
0x410351 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:5924
0x410351 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:5838
0x40dd62 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5295
0x410351 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:5924
0x410351 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:5838
0x40dd62 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5295
0x410351 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:5924
0x410351 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:5838
0x40dd62 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5295
0x410351 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:5924
0x410351 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:5838
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.

Tested revisions:
r207294 - crash
4.8 - unrecognized command line option '-fdeclone-ctor-dtor'


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

* [Bug tree-optimization/60002] ICE: SIGSEGV in skip_artificial_parms_for() with -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone
  2014-01-30 22:12 [Bug tree-optimization/60002] New: ICE: SIGSEGV in skip_artificial_parms_for() with -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone zsojka at seznam dot cz
@ 2014-01-31 13:38 ` jakub at gcc dot gnu.org
  2014-01-31 13:39 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-31 13:38 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think the problem is in build_function_decl_skip_args removing various
arguments for a clone, but DECL_LANG_SPECIFIC being copied rather than thrown
away.  While it takes care to change METHOD_TYPE into FUNCTION_TYPE if the
first parameter is being removed, in this case it is preserved, but other
parameters removed, and whether they must be there or not is recorded in
DECL_LANG_SPECIFIC.


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

* [Bug tree-optimization/60002] ICE: SIGSEGV in skip_artificial_parms_for() with -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone
  2014-01-30 22:12 [Bug tree-optimization/60002] New: ICE: SIGSEGV in skip_artificial_parms_for() with -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone zsojka at seznam dot cz
  2014-01-31 13:38 ` [Bug tree-optimization/60002] " jakub at gcc dot gnu.org
@ 2014-01-31 13:39 ` jakub at gcc dot gnu.org
  2014-01-31 18:09 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-31 13:39 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-01-31
     Ever confirmed|0                           |1

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, either we do something like:
--- gcc/cgraphclones.c.jj    2014-01-03 11:40:46.000000000 +0100
+++ gcc/cgraphclones.c    2014-01-31 14:34:59.734148380 +0100
@@ -390,6 +390,9 @@ build_function_decl_skip_args (tree orig
       DECL_BUILT_IN_CLASS (new_decl) = NOT_BUILT_IN;
       DECL_FUNCTION_CODE (new_decl) = (enum built_in_function) 0;
     }
+  /* The FE might have information and assumptions about the other
+     arguments.  */
+  DECL_LANG_SPECIFIC (new_decl) = NULL;
   return new_decl;
 }

(works on the testcase, otherwise untested), or add some language hook where
the FE will have a chance to adjust it's DECL_LANG_SPECIFIC based on which
arguments are being removed.


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

* [Bug tree-optimization/60002] ICE: SIGSEGV in skip_artificial_parms_for() with -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone
  2014-01-30 22:12 [Bug tree-optimization/60002] New: ICE: SIGSEGV in skip_artificial_parms_for() with -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone zsojka at seznam dot cz
  2014-01-31 13:38 ` [Bug tree-optimization/60002] " jakub at gcc dot gnu.org
  2014-01-31 13:39 ` jakub at gcc dot gnu.org
@ 2014-01-31 18:09 ` jason at gcc dot gnu.org
  2014-02-04 13:38 ` jakub at gcc dot gnu.org
  2014-02-04 13:40 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-31 18:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> +  /* The FE might have information and assumptions about the other
> +     arguments.  */
> +  DECL_LANG_SPECIFIC (new_decl) = NULL;

If that passes testing, it's OK.


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

* [Bug tree-optimization/60002] ICE: SIGSEGV in skip_artificial_parms_for() with -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone
  2014-01-30 22:12 [Bug tree-optimization/60002] New: ICE: SIGSEGV in skip_artificial_parms_for() with -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2014-01-31 18:09 ` jason at gcc dot gnu.org
@ 2014-02-04 13:38 ` jakub at gcc dot gnu.org
  2014-02-04 13:40 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-04 13:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Tue Feb  4 13:38:13 2014
New Revision: 207465

URL: http://gcc.gnu.org/viewcvs?rev=207465&root=gcc&view=rev
Log:
    PR tree-optimization/60002
    * cgraphclones.c (build_function_decl_skip_args): Clear
    DECL_LANG_SPECIFIC.

    * g++.dg/opt/pr60002.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/opt/pr60002.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraphclones.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug tree-optimization/60002] ICE: SIGSEGV in skip_artificial_parms_for() with -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone
  2014-01-30 22:12 [Bug tree-optimization/60002] New: ICE: SIGSEGV in skip_artificial_parms_for() with -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2014-02-04 13:38 ` jakub at gcc dot gnu.org
@ 2014-02-04 13:40 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-04 13:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.0

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2014-02-04 13:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-30 22:12 [Bug tree-optimization/60002] New: ICE: SIGSEGV in skip_artificial_parms_for() with -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone zsojka at seznam dot cz
2014-01-31 13:38 ` [Bug tree-optimization/60002] " jakub at gcc dot gnu.org
2014-01-31 13:39 ` jakub at gcc dot gnu.org
2014-01-31 18:09 ` jason at gcc dot gnu.org
2014-02-04 13:38 ` jakub at gcc dot gnu.org
2014-02-04 13:40 ` jakub 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).