public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/103601] New: [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84
@ 2021-12-07 11:27 rearnsha at gcc dot gnu.org
  2021-12-07 11:34 ` [Bug ipa/103601] " rearnsha at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2021-12-07 11:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103601
           Summary: [12 Regression] ICE in insert_kill, at
                    ipa-modref-tree.c:84
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rearnsha at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---
            Target: arm-none-eabi aarch64-none-elf

The following reduced testcase (from CSiBE) generates an ICE at -O2 or above:

typedef struct { } spinlock_t;
struct list_head {
 struct list_head *next, *prev;
};
struct __wait_queue_head {
 spinlock_t lock;
 struct list_head task_list;
};
typedef struct __wait_queue_head wait_queue_head_t;
static inline void init_waitqueue_head(wait_queue_head_t *q)
{
 q->lock = (spinlock_t) { };
 do { (&q->task_list)->next = (&q->task_list); (&q->task_list)->prev =
(&q->task_list); } while (0);
}
struct timer_list {
 void (*function)(unsigned long);
};
struct rpc_task {
 struct timer_list tk_timer;
 wait_queue_head_t tk_wait;
};
typedef void (*rpc_action)(struct rpc_task *);
static void
rpc_run_timer(struct rpc_task *task)
{
}
inline void
rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
    rpc_action callback, int flags)
{
 task->tk_timer.function = (void (*)(unsigned long)) rpc_run_timer;
 init_waitqueue_head(&task->tk_wait);
}

When compiled with, eg:

-O3 -mcpu=arm1136jf-s -marm -mfpu=vfp -mfloat-abi=softfp -fno-short-enums
-fgnu89-inline -fno-strict-aliasing -fno-common -fomit-frame-pointer
-fno-strength-reduce test.c

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

* [Bug ipa/103601] [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84
  2021-12-07 11:27 [Bug ipa/103601] New: [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 rearnsha at gcc dot gnu.org
@ 2021-12-07 11:34 ` rearnsha at gcc dot gnu.org
  2021-12-07 12:14 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2021-12-07 11:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Backtrace:

during GIMPLE pass: modref
besttry.c: In function ‘rpc_init_task’:
besttry.c:34:1: internal compiler error: in insert_kill, at
ipa-modref-tree.c:845
   34 | }
      | ^
0x6c5067 modref_access_node::insert_kill(vec<modref_access_node, va_heap,
vl_ptr>&, modref_access_node&, bool)
       
/work/rearnsha/gnusrc/nightly/gcc-cross/master/gcc/ipa-modref-tree.c:845
0xcb8a3f analyze_store
        /work/rearnsha/gnusrc/nightly/gcc-cross/master/gcc/ipa-modref.c:1614
0xcb8a3f analyze_store
        /work/rearnsha/gnusrc/nightly/gcc-cross/master/gcc/ipa-modref.c:1582
0xc0bdf4 walk_stmt_load_store_addr_ops(gimple*, void*, bool (*)(gimple*,
tree_node*, tree_node*, void*), bool (*)(gimple*, tree_node*, tree_node*,
void*), bool (*)(gimple*, tree_node*, tree_node*, void*))
        /work/rearnsha/gnusrc/nightly/gcc-cross/master/gcc/gimple-walk.c:767
0xcb9f31 analyze_stmt
        /work/rearnsha/gnusrc/nightly/gcc-cross/master/gcc/ipa-modref.c:1654
0xcc13e3 analyze
        /work/rearnsha/gnusrc/nightly/gcc-cross/master/gcc/ipa-modref.c:1753
0xcc13e3 analyze_function
        /work/rearnsha/gnusrc/nightly/gcc-cross/master/gcc/ipa-modref.c:3070
0xcc33ce execute
        /work/rearnsha/gnusrc/nightly/gcc-cross/master/gcc/ipa-modref.c:4037
Please submit a full bug report,
with preprocessed source if appropriate.

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

* [Bug ipa/103601] [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84
  2021-12-07 11:27 [Bug ipa/103601] New: [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 rearnsha at gcc dot gnu.org
  2021-12-07 11:34 ` [Bug ipa/103601] " rearnsha at gcc dot gnu.org
@ 2021-12-07 12:14 ` rguenth at gcc dot gnu.org
  2021-12-07 13:38 ` [Bug ipa/103601] [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 since r12-5244-g64f3e71c302b4a13 marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-12-07 12:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |hubicka at gcc dot gnu.org
           Priority|P3                          |P1
   Target Milestone|---                         |12.0

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

* [Bug ipa/103601] [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 since r12-5244-g64f3e71c302b4a13
  2021-12-07 11:27 [Bug ipa/103601] New: [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 rearnsha at gcc dot gnu.org
  2021-12-07 11:34 ` [Bug ipa/103601] " rearnsha at gcc dot gnu.org
  2021-12-07 12:14 ` rguenth at gcc dot gnu.org
@ 2021-12-07 13:38 ` marxin at gcc dot gnu.org
  2021-12-10 10:30 ` roger at nextmovesoftware dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-07 13:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-12-07
             Target|arm-none-eabi               |arm-none-eabi
                   |aarch64-none-elf            |aarch64-none-elf,
                   |                            |x86_64-linux-gnu
            Summary|[12 Regression] ICE in      |[12 Regression] ICE in
                   |insert_kill, at             |insert_kill, at
                   |ipa-modref-tree.c:84        |ipa-modref-tree.c:84 since
                   |                            |r12-5244-g64f3e71c302b4a13

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-5244-g64f3e71c302b4a13. Minimal options for x86_64:
-fgnu89-inline -O2.

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

* [Bug ipa/103601] [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 since r12-5244-g64f3e71c302b4a13
  2021-12-07 11:27 [Bug ipa/103601] New: [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 rearnsha at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-12-07 13:38 ` [Bug ipa/103601] [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 since r12-5244-g64f3e71c302b4a13 marxin at gcc dot gnu.org
@ 2021-12-10 10:30 ` roger at nextmovesoftware dot com
  2021-12-10 10:43 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: roger at nextmovesoftware dot com @ 2021-12-10 10:30 UTC (permalink / raw)
  To: gcc-bugs

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

Roger Sayle <roger at nextmovesoftware dot com> changed:

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

--- Comment #3 from Roger Sayle <roger at nextmovesoftware dot com> ---
Patch proposed:
https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586550.html

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

* [Bug ipa/103601] [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 since r12-5244-g64f3e71c302b4a13
  2021-12-07 11:27 [Bug ipa/103601] New: [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 rearnsha at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-12-10 10:30 ` roger at nextmovesoftware dot com
@ 2021-12-10 10:43 ` pinskia at gcc dot gnu.org
  2021-12-10 10:49 ` hubicka at kam dot mff.cuni.cz
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-10 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=103645

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I filed PR 103645 for the not removing the empty struct stores during the
gimplification issue.

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

* [Bug ipa/103601] [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 since r12-5244-g64f3e71c302b4a13
  2021-12-07 11:27 [Bug ipa/103601] New: [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 rearnsha at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-12-10 10:43 ` pinskia at gcc dot gnu.org
@ 2021-12-10 10:49 ` hubicka at kam dot mff.cuni.cz
  2021-12-10 12:04 ` cvs-commit at gcc dot gnu.org
  2021-12-10 21:19 ` roger at nextmovesoftware dot com
  7 siblings, 0 replies; 9+ messages in thread
From: hubicka at kam dot mff.cuni.cz @ 2021-12-10 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from hubicka at kam dot mff.cuni.cz ---
Thanks Roger and Andrew!  It was on my TODO for weekend and I am very
happy you beat me :)

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

* [Bug ipa/103601] [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 since r12-5244-g64f3e71c302b4a13
  2021-12-07 11:27 [Bug ipa/103601] New: [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 rearnsha at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-12-10 10:49 ` hubicka at kam dot mff.cuni.cz
@ 2021-12-10 12:04 ` cvs-commit at gcc dot gnu.org
  2021-12-10 21:19 ` roger at nextmovesoftware dot com
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-10 12:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>:

https://gcc.gnu.org/g:2a1c3b69c015ea49e4c7c08291efd8f7e28e1193

commit r12-5891-g2a1c3b69c015ea49e4c7c08291efd8f7e28e1193
Author: Roger Sayle <roger@nextmovesoftware.com>
Date:   Fri Dec 10 12:02:04 2021 +0000

    PR ipa/103601: ICE compiling CSiBE in ipa-modref's insert_kill.

    This patch fixes PR ipa/103061 which is P1 regression that shows up as
    an ICE in ipa-modref-tree.c's insert_kill when compiling the CSiBE
    benchmark.  I believe the underlying cause is that the new kill tracking
    functionality wasn't anticipating memory accesses that are zero bits
    wide!?.  The failing source code (test case) contains the unusual lines:
    typedef struct { } spinlock_t;
    and
    q->lock = (spinlock_t) { };
    Making spinlock_t larger, or removing the assignment work around the issue.

    The one line patch below to useful_for_kill_p teaches IPA that a memory
    write is only useful as a "kill" if it is more than zero bits wide.
    In theory, the existing known_size_p (size) test is now redundant, as
    poly_int64 currently uses the value -1 for unknown size values,
    but the proposed change makes the semantics clear, and defends against
    possible future changes in representation.

    2021-12-10  Roger Sayle  <roger@nextmovesoftware.com>

    gcc/ChangeLog
            PR ipa/103601
            * ipa-modref-tree.h (useful_for_kill_p): Zero width accesses aren't
            useful for kill tracking.

    gcc/testsuite/ChangeLog
            PR ipa/103601
            * gcc.dg/ipa/pr103601.c: New test case.

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

* [Bug ipa/103601] [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 since r12-5244-g64f3e71c302b4a13
  2021-12-07 11:27 [Bug ipa/103601] New: [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 rearnsha at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-12-10 12:04 ` cvs-commit at gcc dot gnu.org
@ 2021-12-10 21:19 ` roger at nextmovesoftware dot com
  7 siblings, 0 replies; 9+ messages in thread
From: roger at nextmovesoftware dot com @ 2021-12-10 21:19 UTC (permalink / raw)
  To: gcc-bugs

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

Roger Sayle <roger at nextmovesoftware dot com> changed:

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

--- Comment #7 from Roger Sayle <roger at nextmovesoftware dot com> ---
This should now be fixed on mainline.

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

end of thread, other threads:[~2021-12-10 21:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 11:27 [Bug ipa/103601] New: [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 rearnsha at gcc dot gnu.org
2021-12-07 11:34 ` [Bug ipa/103601] " rearnsha at gcc dot gnu.org
2021-12-07 12:14 ` rguenth at gcc dot gnu.org
2021-12-07 13:38 ` [Bug ipa/103601] [12 Regression] ICE in insert_kill, at ipa-modref-tree.c:84 since r12-5244-g64f3e71c302b4a13 marxin at gcc dot gnu.org
2021-12-10 10:30 ` roger at nextmovesoftware dot com
2021-12-10 10:43 ` pinskia at gcc dot gnu.org
2021-12-10 10:49 ` hubicka at kam dot mff.cuni.cz
2021-12-10 12:04 ` cvs-commit at gcc dot gnu.org
2021-12-10 21:19 ` roger at nextmovesoftware 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).