public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/104813] New: ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963
@ 2022-03-07  7:47 zhendong.su at inf dot ethz.ch
  2022-03-07  7:47 ` [Bug ipa/104813] " zhendong.su at inf dot ethz.ch
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2022-03-07  7:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104813
           Summary: ICE on valid code at -O3 on x86_64-linux-gnu: in
                    adjust_references_in_caller, at ipa-cp.cc:4963
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

It appears to be a recent regression.

[550] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220307 (experimental) [master r12-7507-gaad3d935189] (GCC) 
[551] % 
[551] % gcctk -O2 small.c; ./a.out
[552] % 
[552] % gcctk -O3 small.c
during IPA pass: cp
small.c:29:1: internal compiler error: in adjust_references_in_caller, at
ipa-cp.cc:4963
   29 | }
      | ^
0x1c6da79 adjust_references_in_caller
        ../../gcc-trunk/gcc/ipa-cp.cc:4963
0x1c6db04 adjust_refs_in_act_callers
        ../../gcc-trunk/gcc/ipa-cp.cc:4912
0x8afd26 cgraph_node::call_for_symbol_thunks_and_aliases(bool (*)(cgraph_node*,
void*), void*, bool, bool)
        ../../gcc-trunk/gcc/cgraph.cc:2447
0x1c6d969 adjust_references_in_caller
        ../../gcc-trunk/gcc/ipa-cp.cc:4994
0x1c70f63 create_specialized_node
        ../../gcc-trunk/gcc/ipa-cp.cc:5124
0x1c74530 decide_whether_version_node
        ../../gcc-trunk/gcc/ipa-cp.cc:6238
0x1c757fb ipcp_decision_stage
        ../../gcc-trunk/gcc/ipa-cp.cc:6354
0x1c757fb ipcp_driver
        ../../gcc-trunk/gcc/ipa-cp.cc:6542
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
[553] % 
[553] % cat small.c
int a, b, c, d, *e;
void f(int h) {
  if (b) {
    int g;
    while (g++)
      d = *e;
    e++;
  }
}
static void i();
static void j(int *h, int k, int *l) {
  if (c) {
    int *o = h, m;
    f(*l);
    i(m);
    j(o, 1, o);
    for (;;)
      ;
  }
}
void i() {
  int *n = &a;
  while (1)
    j(n, 1, n);
}
int main() {
  j(&a, 0, &a);
  return 0;
}

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

* [Bug ipa/104813] ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963
  2022-03-07  7:47 [Bug ipa/104813] New: ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 zhendong.su at inf dot ethz.ch
@ 2022-03-07  7:47 ` zhendong.su at inf dot ethz.ch
  2022-03-07  9:07 ` [Bug ipa/104813] [12 Regression] " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2022-03-07  7:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
Compiler Explorer: https://godbolt.org/z/6cfcq4Wed

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

* [Bug ipa/104813] [12 Regression] ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963
  2022-03-07  7:47 [Bug ipa/104813] New: ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 zhendong.su at inf dot ethz.ch
  2022-03-07  7:47 ` [Bug ipa/104813] " zhendong.su at inf dot ethz.ch
@ 2022-03-07  9:07 ` rguenth at gcc dot gnu.org
  2022-03-07 10:30 ` [Bug ipa/104813] [12 Regression] ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 since r12-2523-g13586172d0b70c9d marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-03-07  9:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |12.0
            Summary|ICE on valid code at -O3 on |[12 Regression] ICE on
                   |x86_64-linux-gnu: in        |valid code at -O3 on
                   |adjust_references_in_caller |x86_64-linux-gnu: in
                   |, at ipa-cp.cc:4963         |adjust_references_in_caller
                   |                            |, at ipa-cp.cc:4963
   Target Milestone|---                         |12.0
           Keywords|                            |ice-on-valid-code,
                   |                            |needs-bisection

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

* [Bug ipa/104813] [12 Regression] ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 since r12-2523-g13586172d0b70c9d
  2022-03-07  7:47 [Bug ipa/104813] New: ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 zhendong.su at inf dot ethz.ch
  2022-03-07  7:47 ` [Bug ipa/104813] " zhendong.su at inf dot ethz.ch
  2022-03-07  9:07 ` [Bug ipa/104813] [12 Regression] " rguenth at gcc dot gnu.org
@ 2022-03-07 10:30 ` marxin at gcc dot gnu.org
  2022-03-07 13:56 ` jamborm at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-03-07 10:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12 Regression] ICE on      |[12 Regression] ICE on
                   |valid code at -O3 on        |valid code at -O3 on
                   |x86_64-linux-gnu: in        |x86_64-linux-gnu: in
                   |adjust_references_in_caller |adjust_references_in_caller
                   |, at ipa-cp.cc:4963         |, at ipa-cp.cc:4963 since
                   |                            |r12-2523-g13586172d0b70c9d
           Keywords|needs-bisection             |
           Priority|P3                          |P1
     Ever confirmed|0                           |1
                 CC|                            |jamborm at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-03-07

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-2523-g13586172d0b70c9d.

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

* [Bug ipa/104813] [12 Regression] ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 since r12-2523-g13586172d0b70c9d
  2022-03-07  7:47 [Bug ipa/104813] New: ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 zhendong.su at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2022-03-07 10:30 ` [Bug ipa/104813] [12 Regression] ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 since r12-2523-g13586172d0b70c9d marxin at gcc dot gnu.org
@ 2022-03-07 13:56 ` jamborm at gcc dot gnu.org
  2022-03-09 16:25 ` jamborm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2022-03-07 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

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 #3 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Mine.

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

* [Bug ipa/104813] [12 Regression] ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 since r12-2523-g13586172d0b70c9d
  2022-03-07  7:47 [Bug ipa/104813] New: ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 zhendong.su at inf dot ethz.ch
                   ` (3 preceding siblings ...)
  2022-03-07 13:56 ` jamborm at gcc dot gnu.org
@ 2022-03-09 16:25 ` jamborm at gcc dot gnu.org
  2022-03-10 13:56 ` cvs-commit at gcc dot gnu.org
  2022-03-10 14:12 ` jamborm at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2022-03-09 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Martin Jambor <jamborm at gcc dot gnu.org> ---
I have proposed a patch on the mailing list:
https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591423.html

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

* [Bug ipa/104813] [12 Regression] ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 since r12-2523-g13586172d0b70c9d
  2022-03-07  7:47 [Bug ipa/104813] New: ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 zhendong.su at inf dot ethz.ch
                   ` (4 preceding siblings ...)
  2022-03-09 16:25 ` jamborm at gcc dot gnu.org
@ 2022-03-10 13:56 ` cvs-commit at gcc dot gnu.org
  2022-03-10 14:12 ` jamborm at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-10 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:e671e48e352ee278d816d4633146208807a0e403

commit r12-7593-ge671e48e352ee278d816d4633146208807a0e403
Author: Martin Jambor <mjambor@suse.cz>
Date:   Thu Mar 10 14:49:23 2022 +0100

    ipa-cp: Avoid adjusting references through self-recursion (PR 104813)

    When writing the patch that downgrades address-taken references to
    load references when IPA-CP can prove that all uses of the taken
    address ends up in loads, I unfortunately did not take into account
    that find_more_scalar_values_for_callers_subset now happily adds
    self-recursive edges to the set of callers which should be immediately
    redirected (originally recursion was meant to be handled as edge
    redirection in a second pass over the SCC).

    The code as it is can now decrement the referece counters too many
    times.  This can remedied by removing self-recursive edges earlier, we
    already do it because of thunk expansion issues, and so this patch
    does exactly that.

    gcc/ChangeLog:

    2022-03-07  Martin Jambor  <mjambor@suse.cz>

            PR ipa/104813
            * ipa-cp.cc (create_specialized_node): Move removal of
            self-recursive calls from callers vector before refrence
            adjustments.

    gcc/testsuite/ChangeLog:

    2022-03-07  Martin Jambor  <mjambor@suse.cz>

            PR ipa/104813
            * gcc.dg/ipa/pr104813.c: New test.

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

* [Bug ipa/104813] [12 Regression] ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 since r12-2523-g13586172d0b70c9d
  2022-03-07  7:47 [Bug ipa/104813] New: ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 zhendong.su at inf dot ethz.ch
                   ` (5 preceding siblings ...)
  2022-03-10 13:56 ` cvs-commit at gcc dot gnu.org
@ 2022-03-10 14:12 ` jamborm at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2022-03-10 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-03-10 14:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07  7:47 [Bug ipa/104813] New: ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 zhendong.su at inf dot ethz.ch
2022-03-07  7:47 ` [Bug ipa/104813] " zhendong.su at inf dot ethz.ch
2022-03-07  9:07 ` [Bug ipa/104813] [12 Regression] " rguenth at gcc dot gnu.org
2022-03-07 10:30 ` [Bug ipa/104813] [12 Regression] ICE on valid code at -O3 on x86_64-linux-gnu: in adjust_references_in_caller, at ipa-cp.cc:4963 since r12-2523-g13586172d0b70c9d marxin at gcc dot gnu.org
2022-03-07 13:56 ` jamborm at gcc dot gnu.org
2022-03-09 16:25 ` jamborm at gcc dot gnu.org
2022-03-10 13:56 ` cvs-commit at gcc dot gnu.org
2022-03-10 14:12 ` 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).