public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/103099] New: [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4
@ 2021-11-05 11:55 marxin at gcc dot gnu.org
  2021-11-05 11:56 ` [Bug ipa/103099] " marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-05 11:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103099
           Summary: [12 Regression] ICE tree check: expected ssa_name,
                    have debug_expr_decl in split_function, at
                    ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: jamborm at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

The following was isolated from Godot game engine:

$ cat canvas.ii
void pthread_mutex_unlock(int *);
int __gthread_mutex_unlock___mutex, unlock___trans_tmp_1;
struct Object {
  void _change_notify() {}
  bool _is_queued_for_deletion;
};
struct ClassDB {
  template <class N, class M> static int bind_method(N, M);
};
struct CanvasItemMaterial : Object {
  bool particles_animation;
  void set_particles_animation(bool);
};
void CanvasItemMaterial::set_particles_animation(bool p_particles_anim) {
  particles_animation = p_particles_anim;
  if (unlock___trans_tmp_1)
    pthread_mutex_unlock(&__gthread_mutex_unlock___mutex);
  _change_notify();
}
void CanvasItemMaterial_bind_methods() {
  ClassDB::bind_method("", &CanvasItemMaterial::set_particles_animation);
}

$ g++ canvas.ii -O2 -g
during GIMPLE pass: fnsplit
canvas.ii: In member function ‘void
CanvasItemMaterial::set_particles_animation(bool)’:
canvas.ii:22:1: internal compiler error: tree check: expected ssa_name, have
debug_expr_decl in split_function, at ipa-split.c:1397
   22 | }
      | ^
0x8cfd28 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /home/marxin/Programming/gcc/gcc/tree.c:8689
0x978716 tree_check(tree_node*, char const*, int, char const*, tree_code)
        /home/marxin/Programming/gcc/gcc/tree.h:3433
0x978716 split_function
        /home/marxin/Programming/gcc/gcc/ipa-split.c:1397
0x1f2613b execute_split_functions
        /home/marxin/Programming/gcc/gcc/ipa-split.c:1867
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug ipa/103099] [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4
  2021-11-05 11:55 [Bug ipa/103099] New: [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4 marxin at gcc dot gnu.org
@ 2021-11-05 11:56 ` marxin at gcc dot gnu.org
  2021-11-05 13:07 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-05 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-11-05
      Known to work|                            |11.2.0
             Status|UNCONFIRMED                 |NEW
      Known to fail|                            |12.0
     Ever confirmed|0                           |1
   Target Milestone|---                         |12.0

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

* [Bug ipa/103099] [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4
  2021-11-05 11:55 [Bug ipa/103099] New: [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4 marxin at gcc dot gnu.org
  2021-11-05 11:56 ` [Bug ipa/103099] " marxin at gcc dot gnu.org
@ 2021-11-05 13:07 ` rguenth at gcc dot gnu.org
  2021-11-05 13:07 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-05 13:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
(gdb) l
1392              gimple *stmt = gsi_stmt (gsi);
1393              bool remove = false;
1394              if (gimple_clobber_p (stmt) || is_gimple_debug (stmt))
1395                FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
1396                  {
1397                    basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (op));
1398                    if (op != retval
1399                        && bb
1400                        && bb != return_bb
1401                        && bitmap_bit_p (split_point->split_bbs,
bb->index))
(gdb) p debug_gimple_stmt (stmt)
# DEBUG D#1 => &D#2->D.2395
$1 = void

there's no SSA use in this stmt.  Sth forgets to update_stmt or somehow
replaces a non-debug with a debug one in-place.  Huh.

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

* [Bug ipa/103099] [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4
  2021-11-05 11:55 [Bug ipa/103099] New: [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4 marxin at gcc dot gnu.org
  2021-11-05 11:56 ` [Bug ipa/103099] " marxin at gcc dot gnu.org
  2021-11-05 13:07 ` rguenth at gcc dot gnu.org
@ 2021-11-05 13:07 ` rguenth at gcc dot gnu.org
  2021-11-05 13:15 ` jamborm at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-05 13:07 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug ipa/103099] [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4
  2021-11-05 11:55 [Bug ipa/103099] New: [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4 marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-11-05 13:07 ` rguenth at gcc dot gnu.org
@ 2021-11-05 13:15 ` jamborm at gcc dot gnu.org
  2021-11-05 15:06 ` dcb314 at hotmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2021-11-05 13:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Martin Jambor <jamborm at gcc dot gnu.org> ---
I'll have a look.

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

* [Bug ipa/103099] [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4
  2021-11-05 11:55 [Bug ipa/103099] New: [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4 marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-11-05 13:15 ` jamborm at gcc dot gnu.org
@ 2021-11-05 15:06 ` dcb314 at hotmail dot com
  2021-11-05 17:51 ` jamborm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dcb314 at hotmail dot com @ 2021-11-05 15:06 UTC (permalink / raw)
  To: gcc-bugs

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

David Binderman <dcb314 at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dcb314 at hotmail dot com

--- Comment #3 from David Binderman <dcb314 at hotmail dot com> ---
I see this one also. I have a couple of test cases available on request.

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

* [Bug ipa/103099] [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4
  2021-11-05 11:55 [Bug ipa/103099] New: [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4 marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-11-05 15:06 ` dcb314 at hotmail dot com
@ 2021-11-05 17:51 ` jamborm at gcc dot gnu.org
  2021-11-08 16:54 ` cvs-commit at gcc dot gnu.org
  2021-11-08 17:04 ` jamborm at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2021-11-05 17:51 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

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

--- Comment #4 from Martin Jambor <jamborm at gcc dot gnu.org> ---
It is missed unsharing, sorry.  The following seems to fix it.  I'll double
check the other use of remap_with_debug_expressions and propose a patch.

diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index d78e4392b69..431e88dcf67 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1822,7 +1822,7 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id)
       if (gimple_debug_bind_p (stmt))
        {
          tree var = gimple_debug_bind_get_var (stmt);
-         tree value = gimple_debug_bind_get_value (stmt);
+         tree value = unshare_expr (gimple_debug_bind_get_value (stmt));
          if (id->param_body_adjs
              && id->param_body_adjs->m_dead_stmts.contains (stmt))
            id->param_body_adjs->remap_with_debug_expressions (&value);

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

* [Bug ipa/103099] [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4
  2021-11-05 11:55 [Bug ipa/103099] New: [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4 marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-11-05 17:51 ` jamborm at gcc dot gnu.org
@ 2021-11-08 16:54 ` cvs-commit at gcc dot gnu.org
  2021-11-08 17:04 ` jamborm at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-08 16:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Jambor <jamborm@gcc.gnu.org>:

https://gcc.gnu.org/g:239d82d4c05b30632fd09ba4056de7dac5aee070

commit r12-5003-g239d82d4c05b30632fd09ba4056de7dac5aee070
Author: Martin Jambor <mjambor@suse.cz>
Date:   Mon Nov 8 17:49:54 2021 +0100

    ipa: Unshare expresseions before putting them into debug statements (PR
103099, PR 103107)

    My recent patch to improve debug experience when there are removed
    parameters (by ipa-sra or ipa-split) was not careful to unshare the
    expressions that were then put into debug statements, which manifests
    itself as PR 103099.  This patch adds unsharing them using
    unshare_expr_without_location which is a bit more careful with stripping
    locations than what we were doing manually and so also fixes PR 103107.

    gcc/ChangeLog:

    2021-11-08  Martin Jambor  <mjambor@suse.cz>

            PR ipa/103099
            PR ipa/103107
            * tree-inline.c (remap_gimple_stmt): Unshare the expression without
            location before invoking remap_with_debug_expressions on it.
            * ipa-param-manipulation.c
            (ipa_param_body_adjustments::prepare_debug_expressions): Likewise.

    gcc/testsuite/ChangeLog:

    2021-11-08  Martin Jambor  <mjambor@suse.cz>

            PR ipa/103099
            PR ipa/103107
            * g++.dg/ipa/pr103099.C: New test.
            * gcc.dg/ipa/pr103107.c: Likewise.

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

* [Bug ipa/103099] [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4
  2021-11-05 11:55 [Bug ipa/103099] New: [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4 marxin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-11-08 16:54 ` cvs-commit at gcc dot gnu.org
@ 2021-11-08 17:04 ` jamborm at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2021-11-08 17:04 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

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

--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Fixed.  Thanks for testing and sorry for the breakage.

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

end of thread, other threads:[~2021-11-08 17:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 11:55 [Bug ipa/103099] New: [12 Regression] ICE tree check: expected ssa_name, have debug_expr_decl in split_function, at ipa-split.c:1397 since r12-4920-g1ece90ffa9ce63b4 marxin at gcc dot gnu.org
2021-11-05 11:56 ` [Bug ipa/103099] " marxin at gcc dot gnu.org
2021-11-05 13:07 ` rguenth at gcc dot gnu.org
2021-11-05 13:07 ` rguenth at gcc dot gnu.org
2021-11-05 13:15 ` jamborm at gcc dot gnu.org
2021-11-05 15:06 ` dcb314 at hotmail dot com
2021-11-05 17:51 ` jamborm at gcc dot gnu.org
2021-11-08 16:54 ` cvs-commit at gcc dot gnu.org
2021-11-08 17:04 ` jamborm 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).