public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905
@ 2023-02-27 22:37 dcb314 at hotmail dot com
  2023-02-27 22:40 ` [Bug c/108959] " dcb314 at hotmail dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2023-02-27 22:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108959
           Summary: ice in modify_assignment, at
                    ipa-param-manipulation.cc:1905
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Created attachment 54550
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54550&action=edit
C source code

The attached C code does this:

$ ../results/bin/gcc -c -w -O1 bug890.c
$ ../results/bin/gcc -c -w -O2 bug890.c
during IPA pass: inline
In function ‘func_43.constprop.isra’:
cc1: internal compiler error: in modify_assignment, at
ipa-param-manipulation.cc
:1905
0x76b001 ipa_param_body_adjustments::modify_assignment(gimple*, gimple**)
        ../../trunk.d1/gcc/ipa-param-manipulation.cc:1905

I have a reduction running.

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

* [Bug c/108959] ice in modify_assignment, at ipa-param-manipulation.cc:1905
  2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
@ 2023-02-27 22:40 ` dcb314 at hotmail dot com
  2023-02-27 22:49 ` dcb314 at hotmail dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2023-02-27 22:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
The bug first seems to occur sometime between git hash g:5c43f06c228d169c,
dated 20230202 and g:f0065f207cf19cd9, dated 20230203.

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

* [Bug c/108959] ice in modify_assignment, at ipa-param-manipulation.cc:1905
  2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
  2023-02-27 22:40 ` [Bug c/108959] " dcb314 at hotmail dot com
@ 2023-02-27 22:49 ` dcb314 at hotmail dot com
  2023-02-27 23:10 ` [Bug ipa/108959] [13 Regression] " pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2023-02-27 22:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from David Binderman <dcb314 at hotmail dot com> ---
Reduced code seems to be:

union U2 {
  long f0;
  int f1
};
g_16;
g_70[];
static func_61(int) {
  for (;;)
    g_70[g_16] = 4;
}
static func_43(int *p_44) { func_61(*p_44); }
main() {
  union U2 l_38 = {9};
  int *l_49 = &l_38;
  func_43(l_49);
}

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

* [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905
  2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
  2023-02-27 22:40 ` [Bug c/108959] " dcb314 at hotmail dot com
  2023-02-27 22:49 ` dcb314 at hotmail dot com
@ 2023-02-27 23:10 ` pinskia at gcc dot gnu.org
  2023-02-28  7:45 ` dcb314 at hotmail dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-27 23:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ice in modify_assignment,   |[13 Regression] ice in
                   |at                          |modify_assignment, at
                   |ipa-param-manipulation.cc:1 |ipa-param-manipulation.cc:1
                   |905                         |905
   Target Milestone|---                         |13.0

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

* [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905
  2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2023-02-27 23:10 ` [Bug ipa/108959] [13 Regression] " pinskia at gcc dot gnu.org
@ 2023-02-28  7:45 ` dcb314 at hotmail dot com
  2023-02-28  8:09 ` dcb314 at hotmail dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2023-02-28  7:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from David Binderman <dcb314 at hotmail dot com> ---
I will have a go at a git bisection.

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

* [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905
  2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2023-02-28  7:45 ` dcb314 at hotmail dot com
@ 2023-02-28  8:09 ` dcb314 at hotmail dot com
  2023-02-28  8:27 ` dcb314 at hotmail dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2023-02-28  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from David Binderman <dcb314 at hotmail dot com> ---

Only one pass at reduction, leaving 14 revisions, but  
this commit looks to be a hot candidate:

commit e8109bd87766be88e83fe88a44433dae16358a02
Author: Martin Jambor <mjambor@suse.cz>
Date:   Fri Feb 3 13:28:24 2023 +0100

    ipa: Avoid invalid gimple when IPA-CP and IPA-SRA disagree on types
(108384)

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

* [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905
  2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2023-02-28  8:09 ` dcb314 at hotmail dot com
@ 2023-02-28  8:27 ` dcb314 at hotmail dot com
  2023-02-28  8:37 ` dcb314 at hotmail dot com
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2023-02-28  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

David Binderman <dcb314 at hotmail dot com> changed:

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

--- Comment #5 from David Binderman <dcb314 at hotmail dot com> ---
Three C++ changes and Martin's change.

Adding Martin for their best advice.

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

* [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905
  2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2023-02-28  8:27 ` dcb314 at hotmail dot com
@ 2023-02-28  8:37 ` dcb314 at hotmail dot com
  2023-02-28 10:47 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2023-02-28  8:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from David Binderman <dcb314 at hotmail dot com> ---
As expected:

$ git bisect bad e8109bd87766be88
e8109bd87766be88e83fe88a44433dae16358a02 is the first bad commit
commit e8109bd87766be88e83fe88a44433dae16358a02
Author: Martin Jambor <mjambor@suse.cz>
Date:   Fri Feb 3 13:28:24 2023 +0100

    ipa: Avoid invalid gimple when IPA-CP and IPA-SRA disagree on types
(108384)

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

* [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905
  2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2023-02-28  8:37 ` dcb314 at hotmail dot com
@ 2023-02-28 10:47 ` rguenth at gcc dot gnu.org
  2023-03-01 15:08 ` [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905 since r13-5681-ge8109bd87766be jamborm at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-28 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
   Last reconfirmed|                            |2023-02-28
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

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

* [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905 since r13-5681-ge8109bd87766be
  2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2023-02-28 10:47 ` rguenth at gcc dot gnu.org
@ 2023-03-01 15:08 ` jamborm at gcc dot gnu.org
  2023-03-01 16:50 ` jamborm at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2023-03-01 15:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

* [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905 since r13-5681-ge8109bd87766be
  2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
                   ` (8 preceding siblings ...)
  2023-03-01 15:08 ` [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905 since r13-5681-ge8109bd87766be jamborm at gcc dot gnu.org
@ 2023-03-01 16:50 ` jamborm at gcc dot gnu.org
  2023-03-23 10:19 ` jamborm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2023-03-01 16:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Martin Jambor <jamborm at gcc dot gnu.org> ---
The situation is that in func_61 we have an unused parameter which
IPA-SRA wants to remove.  It's caller constructs the unused parameter
with the following sequence (shortened):

int func_43 (int * p_44)
{
  int _1;
  _1 = *p_44_3(D);
  func_61 (_1);
}

Caller of func_43 however stores a long at that address and this is
what IPA-CP wants to pass down, while IPA-SRA knows that p_44 is used
only to create an argument for an unused formal parameter and would
like to remove both.

This means that the code in ipa-param-manipulation.cc kicks in, trying
to replace loads from the disappearing parameter with known constants
because once the parameter is gone there this can no longer be done.
But it attempts to create an invalid VIEW_CONVERT_EXPR in the process.

The simplest way of avoiding it is to disable the removal of the
parameter in these situations too extending the patch from e8109bd8776
with:

diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc
index 3de7d426b7e..e9c47c0d852 100644
--- a/gcc/ipa-sra.cc
+++ b/gcc/ipa-sra.cc
@@ -4235,6 +4235,7 @@ adjust_parameter_descriptions (cgraph_node *node,
isra_func_summary *ifs)
                          != pa->unit_size))
                    {
                      desc->split_candidate = false;
+                     desc->locally_unused = false;
                      if (dump_file && (dump_flags & TDF_DETAILS))
                        dump_dead_indices.safe_push (i);
                      break;


But since this is all code that will be eliminated anyway, perhaps we
could be aggressive here and use force_value_to_type from
tree-inline.cc?

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

* [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905 since r13-5681-ge8109bd87766be
  2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
                   ` (9 preceding siblings ...)
  2023-03-01 16:50 ` jamborm at gcc dot gnu.org
@ 2023-03-23 10:19 ` jamborm at gcc dot gnu.org
  2023-04-05 14:39 ` cvs-commit at gcc dot gnu.org
  2023-04-05 14:44 ` jamborm at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2023-03-23 10:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Martin Jambor <jamborm at gcc dot gnu.org> ---
I have proposed a fix on the mailing list:
https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614475.html

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

* [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905 since r13-5681-ge8109bd87766be
  2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
                   ` (10 preceding siblings ...)
  2023-03-23 10:19 ` jamborm at gcc dot gnu.org
@ 2023-04-05 14:39 ` cvs-commit at gcc dot gnu.org
  2023-04-05 14:44 ` jamborm at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-05 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 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:f0f372fab3e70622a4ea6fe4073991e1bb506e4e

commit r13-7011-gf0f372fab3e70622a4ea6fe4073991e1bb506e4e
Author: Martin Jambor <mjambor@suse.cz>
Date:   Wed Apr 5 16:36:49 2023 +0200

    ipa: Avoid another ICE when dealing with type-incompatibilities (PR 108959)

    PR 108959 shows one more example where undefined code with type
    incompatible accesses to stuff passed in parameters can cause an ICE
    because we try to create a VIEW_CONVERT_EXPR of mismatching sizes:

    1. IPA-CP tries to push one type from above,

    2. IPA-SRA (correctly) decides the parameter is useless because it is
       only used to construct an argument to another function which does not
       use it and so the formal parameter should be removed,

    3. but the code reconciling IPA-CP and IPA-SRA transformations still
       wants to perform the IPA-CP and overrides the built-in DCE of
       useless statements and tries to stuff constants into them
       instead, constants of a type with mismatching type and size.

    This patch avoids the situation in IPA-SRA by purging the IPA-CP
    results from any "aggregate" constants that are passed in parameters
    which are detected to be useless.  It also removes IPA value range and
    bits information associated with removed parameters stored in the same
    structure so that the useless information is not streamed later on.

    gcc/ChangeLog:

    2023-03-22  Martin Jambor  <mjambor@suse.cz>

            PR ipa/108959
            * ipa-sra.cc (zap_useless_ipcp_results): New function.
            (process_isra_node_results): Call it.

    gcc/testsuite/ChangeLog:

    2023-03-17  Martin Jambor  <mjambor@suse.cz>

            PR ipa/108959
            * gcc.dg/ipa/pr108959.c: New test.

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

* [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905 since r13-5681-ge8109bd87766be
  2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
                   ` (11 preceding siblings ...)
  2023-04-05 14:39 ` cvs-commit at gcc dot gnu.org
@ 2023-04-05 14:44 ` jamborm at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jamborm at gcc dot gnu.org @ 2023-04-05 14:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2023-04-05 14:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 22:37 [Bug c/108959] New: ice in modify_assignment, at ipa-param-manipulation.cc:1905 dcb314 at hotmail dot com
2023-02-27 22:40 ` [Bug c/108959] " dcb314 at hotmail dot com
2023-02-27 22:49 ` dcb314 at hotmail dot com
2023-02-27 23:10 ` [Bug ipa/108959] [13 Regression] " pinskia at gcc dot gnu.org
2023-02-28  7:45 ` dcb314 at hotmail dot com
2023-02-28  8:09 ` dcb314 at hotmail dot com
2023-02-28  8:27 ` dcb314 at hotmail dot com
2023-02-28  8:37 ` dcb314 at hotmail dot com
2023-02-28 10:47 ` rguenth at gcc dot gnu.org
2023-03-01 15:08 ` [Bug ipa/108959] [13 Regression] ice in modify_assignment, at ipa-param-manipulation.cc:1905 since r13-5681-ge8109bd87766be jamborm at gcc dot gnu.org
2023-03-01 16:50 ` jamborm at gcc dot gnu.org
2023-03-23 10:19 ` jamborm at gcc dot gnu.org
2023-04-05 14:39 ` cvs-commit at gcc dot gnu.org
2023-04-05 14:44 ` 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).