public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name)
@ 2022-05-09 17:26 asolokha at gmx dot com
  2022-05-10  7:09 ` [Bug tree-optimization/105537] " rguenth at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: asolokha at gmx dot com @ 2022-05-09 17:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105537
           Summary: ICE: cannot update SSA form (error: statement uses
                    released SSA name)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

gcc 13.0.0 20220508 snapshot (g:a1947c92f7cda5f6cf7b8d8a9a44f6dd45352c03) ICEs
when compiling the following testcase w/ -O3 -ffast-math -fsignaling-nans
-fvar-tracking-assignments -fno-move-loop-stores:

int n;

double
ext1 (int);

void
ext2 (double);

int
sum (int v1, int v2)
{
  return v1 + v2;
}

void
bar (void)
{
  ext2 (ext1 (n));
}

__attribute__ ((optimize ("-O3"))) void
foo (int *x)
{
  static int i;

  bar ();
  for (i = 0; i != 2; i = sum (i, 1))
    n = *x = 0;
}

% gcc-13.0.0 -O3 -ffast-math -fsignaling-nans -fvar-tracking-assignments
-fno-move-loop-stores -w -c sqnqheby.c
sqnqheby.c: In function 'foo':
sqnqheby.c:22:1: error: statement uses released SSA name
   22 | foo (int *x)
      | ^~~
# DEBUG v1 => _1
The use of _1 should have been replaced
during GIMPLE pass: ldist
sqnqheby.c:22:1: internal compiler error: cannot update SSA form
0xf70cc6 update_ssa(unsigned int)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220508/work/gcc-13-20220508/gcc/tree-into-ssa.cc:3349
0x104f1c4 rewrite_into_loop_closed_ssa_1(bitmap_head*, unsigned int, int,
loop*)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220508/work/gcc-13-20220508/gcc/tree-ssa-loop-manip.cc:642
0x104f1c4 rewrite_into_loop_closed_ssa_1(bitmap_head*, unsigned int, int,
loop*)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220508/work/gcc-13-20220508/gcc/tree-ssa-loop-manip.cc:629
0xf7d869 loop_distribution::execute(function*)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220508/work/gcc-13-20220508/gcc/tree-loop-distribution.cc:3865
0xf7e097 execute
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220508/work/gcc-13-20220508/gcc/tree-loop-distribution.cc:3912

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

* [Bug tree-optimization/105537] ICE: cannot update SSA form (error: statement uses released SSA name)
  2022-05-09 17:26 [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name) asolokha at gmx dot com
@ 2022-05-10  7:09 ` rguenth at gcc dot gnu.org
  2022-05-10  7:42 ` rguenth at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-10  7:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-05-10
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  I'll take a look.

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

* [Bug tree-optimization/105537] ICE: cannot update SSA form (error: statement uses released SSA name)
  2022-05-09 17:26 [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name) asolokha at gmx dot com
  2022-05-10  7:09 ` [Bug tree-optimization/105537] " rguenth at gcc dot gnu.org
@ 2022-05-10  7:42 ` rguenth at gcc dot gnu.org
  2022-05-10  7:46 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-10  7:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
So it's _another_ case where we have debug stmts but don't expect them.  Again,
-fvar-tracking-assignments seems to enable that despite no debug info.

(gdb) p global_options_set.x_flag_var_tracking_assignments
$1 = 1
(gdb) p global_options.x_flag_var_tracking_assignments
$2 = 0

when we create the debug bind it's

(gdb) p global_options.x_flag_var_tracking_assignments
$1 = -1

so that's likely the

  if (flag_var_tracking_assignments && !flag_var_tracking)
    flag_var_tracking = flag_var_tracking_assignments = -1;

part of finish_options I wondered about when fixing PR105461, but we also
have before that

  if (!opts_set->x_flag_var_tracking_assignments)
    flag_var_tracking_assignments
      = (flag_var_tracking
         && !(flag_selective_scheduling || flag_selective_scheduling2));

so we keep the flag as set but then reset things to -1.

it looks like more failure to use opts->

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

* [Bug tree-optimization/105537] ICE: cannot update SSA form (error: statement uses released SSA name)
  2022-05-09 17:26 [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name) asolokha at gmx dot com
  2022-05-10  7:09 ` [Bug tree-optimization/105537] " rguenth at gcc dot gnu.org
  2022-05-10  7:42 ` rguenth at gcc dot gnu.org
@ 2022-05-10  7:46 ` rguenth at gcc dot gnu.org
  2022-05-10  8:09 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-10  7:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
But fixing that doesn't fix the issue.  I'll have to trace down where the
mismatch starts - it's somewhere in instantiating the different option set.

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

* [Bug tree-optimization/105537] ICE: cannot update SSA form (error: statement uses released SSA name)
  2022-05-09 17:26 [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name) asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-05-10  7:46 ` rguenth at gcc dot gnu.org
@ 2022-05-10  8:09 ` rguenth at gcc dot gnu.org
  2022-05-10  8:17 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-10  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the issue is that finish_options consistently produces the
flag_var_tracking = flag_var_tracking_assignments = -1 state but for the
toplev.cc invocation via decode_options we then override this from
process_options with 0 in

  /* We know which debug output will be used so we can set flag_var_tracking
     and flag_var_tracking_uninit if the user has not specified them.  */
  if (debug_info_level < DINFO_LEVEL_NORMAL
      || !dwarf_debuginfo_p ()
      || debug_hooks->var_location == do_nothing_debug_hooks.var_location)
    {
...
      flag_var_tracking = 0;
      flag_var_tracking_uninit = 0;
      flag_var_tracking_assignments = 0;
    }

but that's only done once.  I'll note that finish_options has

  /* One could use EnabledBy, but it would lead to a circular dependency.  */
  if (!opts_set->x_flag_var_tracking_uninit)
    opts->x_flag_var_tracking_uninit = opts->x_flag_var_tracking;

but before the -1 setting but after resetting flag_var_tracking to false
for < DINFO_LEVEL_NORMAL.

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

* [Bug tree-optimization/105537] ICE: cannot update SSA form (error: statement uses released SSA name)
  2022-05-09 17:26 [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name) asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-05-10  8:09 ` rguenth at gcc dot gnu.org
@ 2022-05-10  8:17 ` rguenth at gcc dot gnu.org
  2022-05-10  8:20 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-10  8:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoliva at gcc dot gnu.org

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
That -1 setting was originally added by as

@@ -1977,6 +1989,15 @@ process_options (void)
   if (flag_var_tracking == AUTODETECT_VALUE)
     flag_var_tracking = optimize >= 1;

+  if (flag_var_tracking_assignments == AUTODETECT_VALUE)
+    flag_var_tracking_assignments = 0;
+
+  if (flag_var_tracking_assignments_toggle)
+    flag_var_tracking_assignments = !flag_var_tracking_assignments;
+
+  if (flag_var_tracking_assignments && !flag_var_tracking)
+    flag_var_tracking = flag_var_tracking_assignments = -1;
+
   if (flag_tree_cselim == AUTODETECT_VALUE)
 #ifdef HAVE_conditional_move
     flag_tree_cselim = 1;

the flags documentation at that point said (it's no longer there)

+/* Positive if we should track variables, negative if we should run
+   the var-tracking pass only to discard debug annotations, zero if
+   we're not to run it.  When flag_var_tracking == AUTODETECT_VALUE it
+   will be set according to optimize, debug_info_level and debug_hooks
+   in process_options ().  */
 int flag_var_tracking = AUTODETECT_VALUE;

+/* Positive if we should track variables at assignments, negative if
+   we should run the var-tracking pass only to discard debug
+   annotations.  When flag_var_tracking_assignments ==
+   AUTODETECT_VALUE it will be set according to flag_var_tracking.  */
+int flag_var_tracking_assignments = AUTODETECT_VALUE;
+
+/* Nonzero if we should toggle flag_var_tracking_assignments after
+   processing options and computing its default.  */
+int flag_var_tracking_assignments_toggle = 0;

I'm unsure how the -1 setting was supposed to materialize with the
debuginfo level check, but I _think_ that eventually the desire was
to have -fvar-tracking-assignments work in "dummy" mode even with -g0
(but not really tied to flag_var_tracking?).

I will try to make it work that way again by removing the = 0 setting
from toplev.cc but keeping the diagnostic only.

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

* [Bug tree-optimization/105537] ICE: cannot update SSA form (error: statement uses released SSA name)
  2022-05-09 17:26 [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name) asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2022-05-10  8:17 ` rguenth at gcc dot gnu.org
@ 2022-05-10  8:20 ` rguenth at gcc dot gnu.org
  2022-05-10 11:04 ` [Bug tree-optimization/105537] [12 Regression] " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-10  8:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Btw, -fvar-tracking-uninit without -g produces the diagnostic but
-fvar-tracking doesn't anymore (as expected from the finish_options hunk).

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

* [Bug tree-optimization/105537] [12 Regression] ICE: cannot update SSA form (error: statement uses released SSA name)
  2022-05-09 17:26 [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name) asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2022-05-10  8:20 ` rguenth at gcc dot gnu.org
@ 2022-05-10 11:04 ` rguenth at gcc dot gnu.org
  2022-05-10 11:05 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-10 11:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE: cannot update SSA form |[12 Regression] ICE: cannot
                   |(error: statement uses      |update SSA form (error:
                   |released SSA name)          |statement uses released SSA
                   |                            |name)
   Target Milestone|---                         |12.2
           Priority|P3                          |P2

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

* [Bug tree-optimization/105537] [12 Regression] ICE: cannot update SSA form (error: statement uses released SSA name)
  2022-05-09 17:26 [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name) asolokha at gmx dot com
                   ` (6 preceding siblings ...)
  2022-05-10 11:04 ` [Bug tree-optimization/105537] [12 Regression] " rguenth at gcc dot gnu.org
@ 2022-05-10 11:05 ` cvs-commit at gcc dot gnu.org
  2022-05-10 11:05 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-10 11:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:76db543db88727789a6c117608a23edc2eace713

commit r13-259-g76db543db88727789a6c117608a23edc2eace713
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 10 11:44:40 2022 +0200

    middle-end/105537 - debug processing

    The following makes sure to have a consistent state of
    flag_var_tracking_assignments with the distributed handling
    in process_options and finish_options by moving everything to
    finish_options which also restores diagnostics for
    -g0 -fvar-tracking which was lost with previous changes.

    2022-05-10  Richard Biener  <rguenther@suse.de>

            PR middle-end/105537
            * toplev.cc (process_options): Move flag_var_tracking
            handling ...
            * opts.cc (finish_options): ... here.

            * gcc.dg/torture/pr105537.c: New testcase.

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

* [Bug tree-optimization/105537] [12 Regression] ICE: cannot update SSA form (error: statement uses released SSA name)
  2022-05-09 17:26 [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name) asolokha at gmx dot com
                   ` (7 preceding siblings ...)
  2022-05-10 11:05 ` cvs-commit at gcc dot gnu.org
@ 2022-05-10 11:05 ` rguenth at gcc dot gnu.org
  2022-05-11  8:50 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-10 11:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |13.0

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.

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

* [Bug tree-optimization/105537] [12 Regression] ICE: cannot update SSA form (error: statement uses released SSA name)
  2022-05-09 17:26 [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name) asolokha at gmx dot com
                   ` (8 preceding siblings ...)
  2022-05-10 11:05 ` rguenth at gcc dot gnu.org
@ 2022-05-11  8:50 ` rguenth at gcc dot gnu.org
  2022-05-19 12:47 ` cvs-commit at gcc dot gnu.org
  2022-05-19 12:50 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-11  8:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105537
Bug 105537 depends on bug 105551, which changed state.

Bug 105551 Summary: [13 Regression] [nvptx] ICE in final_scan_insn_1, at final.cc:2629 when building libgcc2.c since r13-259-g76db543db88727789a6c117608a23edc2eace713
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105551

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

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

* [Bug tree-optimization/105537] [12 Regression] ICE: cannot update SSA form (error: statement uses released SSA name)
  2022-05-09 17:26 [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name) asolokha at gmx dot com
                   ` (9 preceding siblings ...)
  2022-05-11  8:50 ` rguenth at gcc dot gnu.org
@ 2022-05-19 12:47 ` cvs-commit at gcc dot gnu.org
  2022-05-19 12:50 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-19 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:a53eff4ad05f234a509dd2995d5a7612d5baa4e8

commit r12-8398-ga53eff4ad05f234a509dd2995d5a7612d5baa4e8
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 10 11:44:40 2022 +0200

    middle-end/105537 - debug processing

    The following makes sure to have a consistent state of
    flag_var_tracking_assignments with the distributed handling
    in process_options and finish_options by moving everything to
    finish_options which also restores diagnostics for
    -g0 -fvar-tracking which was lost with previous changes.

    2022-05-10  Richard Biener  <rguenther@suse.de>

            PR middle-end/105537
            * toplev.cc (process_options): Move flag_var_tracking
            handling ...
            * opts.cc (finish_options): ... here.

            * gcc.dg/torture/pr105537.c: New testcase.

    (cherry picked from commit 76db543db88727789a6c117608a23edc2eace713)

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

* [Bug tree-optimization/105537] [12 Regression] ICE: cannot update SSA form (error: statement uses released SSA name)
  2022-05-09 17:26 [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name) asolokha at gmx dot com
                   ` (10 preceding siblings ...)
  2022-05-19 12:47 ` cvs-commit at gcc dot gnu.org
@ 2022-05-19 12:50 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-19 12:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
      Known to work|                            |12.1.1
      Known to fail|                            |12.1.0

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-05-19 12:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 17:26 [Bug tree-optimization/105537] New: ICE: cannot update SSA form (error: statement uses released SSA name) asolokha at gmx dot com
2022-05-10  7:09 ` [Bug tree-optimization/105537] " rguenth at gcc dot gnu.org
2022-05-10  7:42 ` rguenth at gcc dot gnu.org
2022-05-10  7:46 ` rguenth at gcc dot gnu.org
2022-05-10  8:09 ` rguenth at gcc dot gnu.org
2022-05-10  8:17 ` rguenth at gcc dot gnu.org
2022-05-10  8:20 ` rguenth at gcc dot gnu.org
2022-05-10 11:04 ` [Bug tree-optimization/105537] [12 Regression] " rguenth at gcc dot gnu.org
2022-05-10 11:05 ` cvs-commit at gcc dot gnu.org
2022-05-10 11:05 ` rguenth at gcc dot gnu.org
2022-05-11  8:50 ` rguenth at gcc dot gnu.org
2022-05-19 12:47 ` cvs-commit at gcc dot gnu.org
2022-05-19 12:50 ` rguenth 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).