public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/102505] New: [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368
@ 2021-09-27 19:49 gscfq@t-online.de
2021-09-27 19:49 ` [Bug c/102505] " gscfq@t-online.de
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: gscfq@t-online.de @ 2021-09-27 19:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102505
Bug ID: 102505
Summary: [10/11/12 Regression] ICE in verify_sra_access_forest,
at tree-sra.c:2368
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: gscfq@t-online.de
Target Milestone: ---
Changed between 20200126 and 20200202, at -O2+ :
(case derived from g++.dg/cpp0x/nsdmi-virtual1a.C)
(gcc configured with --enable-checking=yes)
$ cat z1.cc
struct A
{
A(): i(42) { }
long double i;
int f() { return i; }
};
struct D : A { int pad; };
struct B : virtual D
{
int j = i + f();
int k = A::i + A::f();
};
struct C: B { int pad; };
int main()
{
C c;
if (c.j != 84 || c.k != 84)
__builtin_abort();
}
$ g++-12-20210926 -c z1.cc -O2
during GIMPLE pass: esra
z1.cc: In function 'int main()':
z1.cc:23:1: internal compiler error: in verify_sra_access_forest, at
tree-sra.c:2368
23 | }
| ^
0x1247974 verify_sra_access_forest(access*)
../../gcc/tree-sra.c:2367
0x1247c31 verify_all_sra_access_forests()
../../gcc/tree-sra.c:2434
0x124be95 analyze_all_variable_accesses
../../gcc/tree-sra.c:3497
0x124c916 perform_intra_sra
../../gcc/tree-sra.c:4673
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/102505] [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368
2021-09-27 19:49 [Bug c/102505] New: [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368 gscfq@t-online.de
@ 2021-09-27 19:49 ` gscfq@t-online.de
2021-09-27 22:01 ` [Bug tree-optimization/102505] " pinskia at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: gscfq@t-online.de @ 2021-09-27 19:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102505
--- Comment #1 from G. Steinmetz <gscfq@t-online.de> ---
$ cat z2.cc
struct A
{
A(): i(42) { }
int i;
int f() { return i; }
};
struct D : A { long double pad; };
struct B : virtual D
{
int j = i + f();
int k = A::i + A::f();
};
struct C: B { int pad; };
int main()
{
C c;
if (c.j != 84 || c.k != 84)
__builtin_abort();
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368
2021-09-27 19:49 [Bug c/102505] New: [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368 gscfq@t-online.de
2021-09-27 19:49 ` [Bug c/102505] " gscfq@t-online.de
@ 2021-09-27 22:01 ` pinskia at gcc dot gnu.org
2021-09-28 8:36 ` [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance rguenth at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-27 22:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102505
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jamborm at gcc dot gnu.org
Last reconfirmed| |2021-09-27
Ever confirmed|0 |1
Target| |x86_64-*-*
Component|c++ |tree-optimization
Target Milestone|--- |10.4
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=93516,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=93667,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=93845,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=93776,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=94598,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=96730,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=96820,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=101626
Status|UNCONFIRMED |NEW
Keywords| |ice-on-valid-code
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed more reduced:
struct D { int i; int pad alignas(16); };
struct B : virtual D
{
int j =84;
int k =84;
};
struct C: B { };
int main()
{
C c;
if (c.j != 84 || c.k != 84)
__builtin_abort();
}
---- CUT ----
Most likely r10-6276-g1d8593070a62b.
What I don't get is why the ICE only happens on x86_64 and not on aarch64. I
moved over to using alignas instead of long double to be similar on both
targets.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance
2021-09-27 19:49 [Bug c/102505] New: [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368 gscfq@t-online.de
2021-09-27 19:49 ` [Bug c/102505] " gscfq@t-online.de
2021-09-27 22:01 ` [Bug tree-optimization/102505] " pinskia at gcc dot gnu.org
@ 2021-09-28 8:36 ` rguenth at gcc dot gnu.org
2021-09-30 9:52 ` [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance since r10-6321-g636e80eea24b780f marxin at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-09-28 8:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102505
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance since r10-6321-g636e80eea24b780f
2021-09-27 19:49 [Bug c/102505] New: [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368 gscfq@t-online.de
` (2 preceding siblings ...)
2021-09-28 8:36 ` [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance rguenth at gcc dot gnu.org
@ 2021-09-30 9:52 ` marxin at gcc dot gnu.org
2021-10-07 15:48 ` jamborm at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-09-30 9:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102505
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11/12 Regression] ICE |[10/11/12 Regression] ICE
|in verify_sra_access_forest |in verify_sra_access_forest
|with 16 byte aligned field |with 16 byte aligned field
|and virtual inheritance |and virtual inheritance
| |since
| |r10-6321-g636e80eea24b780f
CC| |marxin at gcc dot gnu.org
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
No, it started with r10-6321-g636e80eea24b780f.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance since r10-6321-g636e80eea24b780f
2021-09-27 19:49 [Bug c/102505] New: [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368 gscfq@t-online.de
` (3 preceding siblings ...)
2021-09-30 9:52 ` [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance since r10-6321-g636e80eea24b780f marxin at gcc dot gnu.org
@ 2021-10-07 15:48 ` jamborm at gcc dot gnu.org
2021-10-21 10:58 ` jamborm at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jamborm at gcc dot gnu.org @ 2021-10-07 15:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102505
Martin Jambor <jamborm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jamborm at gcc dot gnu.org
--- Comment #4 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Mine.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance since r10-6321-g636e80eea24b780f
2021-09-27 19:49 [Bug c/102505] New: [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368 gscfq@t-online.de
` (4 preceding siblings ...)
2021-10-07 15:48 ` jamborm at gcc dot gnu.org
@ 2021-10-21 10:58 ` jamborm at gcc dot gnu.org
2021-10-21 12:56 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jamborm at gcc dot gnu.org @ 2021-10-21 10:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102505
--- Comment #5 from Martin Jambor <jamborm at gcc dot gnu.org> ---
I proposed a patch on the mailing list:
https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582249.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance since r10-6321-g636e80eea24b780f
2021-09-27 19:49 [Bug c/102505] New: [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368 gscfq@t-online.de
` (5 preceding siblings ...)
2021-10-21 10:58 ` jamborm at gcc dot gnu.org
@ 2021-10-21 12:56 ` cvs-commit at gcc dot gnu.org
2021-10-25 13:27 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-21 12:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102505
--- Comment #6 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:701ee067807b80957c65bd7ff94b6099a27181de
commit r12-4607-g701ee067807b80957c65bd7ff94b6099a27181de
Author: Martin Jambor <mjambor@suse.cz>
Date: Thu Oct 21 14:26:45 2021 +0200
sra: Fix corner case of total scalarization with virtual inheritance (PR
102505)
PR 102505 is a situation where of SRA takes its initial top-level
access size from a get_ref_base_and_extent called on a COMPONENT_REF,
and thus derived frm the FIELD_DECL, which however does not include a
virtual base. Total scalarization then goes on traversing the type,
which however has virtual base past the non-virtual bits, tricking SRA
to create sub-accesses outside of the supposedly encompassing
accesses, which in turn triggers the verifier within the pass.
The patch below fixes that by failing total scalarization when this
situation is detected.
gcc/ChangeLog:
2021-10-20 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/102505
* tree-sra.c (totally_scalarize_subtree): Check that the
encountered field fits within the acces we would like to put it
in.
gcc/testsuite/ChangeLog:
2021-10-20 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/102505
* g++.dg/torture/pr102505.C: New test.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance since r10-6321-g636e80eea24b780f
2021-09-27 19:49 [Bug c/102505] New: [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368 gscfq@t-online.de
` (6 preceding siblings ...)
2021-10-21 12:56 ` cvs-commit at gcc dot gnu.org
@ 2021-10-25 13:27 ` cvs-commit at gcc dot gnu.org
2021-10-27 17:17 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-25 13:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102505
--- Comment #7 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:f217e87972a2a207e793101fc05cfc9dd095c678
commit r12-4662-gf217e87972a2a207e793101fc05cfc9dd095c678
Author: Martin Jambor <mjambor@suse.cz>
Date: Mon Oct 25 15:22:06 2021 +0200
sra: Fix the fix for PR 102505 (PR 102886)
I was not careful with the fix for PR 102505 and did not craft the
check to satisfy the verifier carefully, which lead to PR 102886.
(The verifier has the test structured differently and somewhat
redundantly, so I could not just copy it).
This patch fixes it. I hope it is quite obvious correction of an
oversight and so will commit it if survives bootstrap and testing on
x86_64-linux and ppc64le-linux.
Testcase for this bug is gcc.dg/tree-ssa/sra-18.c (but only on
platforms with constant pools). I will backport the two fixes
to the release branches squashed.
gcc/ChangeLog:
2021-10-22 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/102886
* tree-sra.c (totally_scalarize_subtree): Fix the out of
access-condition.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance since r10-6321-g636e80eea24b780f
2021-09-27 19:49 [Bug c/102505] New: [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368 gscfq@t-online.de
` (7 preceding siblings ...)
2021-10-25 13:27 ` cvs-commit at gcc dot gnu.org
@ 2021-10-27 17:17 ` cvs-commit at gcc dot gnu.org
2021-11-02 10:19 ` cvs-commit at gcc dot gnu.org
2021-11-02 12:29 ` jamborm at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-27 17:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102505
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Martin Jambor
<jamborm@gcc.gnu.org>:
https://gcc.gnu.org/g:97cebda80d367737c0b25909af8063b63166e00b
commit r11-9189-g97cebda80d367737c0b25909af8063b63166e00b
Author: Martin Jambor <mjambor@suse.cz>
Date: Wed Oct 27 19:15:33 2021 +0200
sra: Fix corner case of total scalarization with virtual inheritance (PR
102505)
PR 102505 is a situation where of SRA takes its initial top-level
access size from a get_ref_base_and_extent called on a COMPONENT_REF,
and thus derived frm the FIELD_DECL, which however does not include a
virtual base. Total scalarization then goes on traversing the type,
which however has virtual base past the non-virtual bits, tricking SRA
to create sub-accesses outside of the supposedly encompassing
accesses, which in turn triggers the verifier within the pass.
The patch below fixes that by failing total scalarization when this
situation is detected.
This backport also has commit f217e87972a2a207e793101fc05cfc9dd095c678
squashed into it in order to avoid PR 102886 that the fix introduced
on trunk.
gcc/ChangeLog:
2021-10-20 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/102505
* tree-sra.c (totally_scalarize_subtree): Check that the
encountered field fits within the acces we would like to put it
in.
gcc/testsuite/ChangeLog:
2021-10-20 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/102505
* g++.dg/torture/pr102505.C: New test.
(cherry picked from commit 701ee067807b80957c65bd7ff94b6099a27181de)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance since r10-6321-g636e80eea24b780f
2021-09-27 19:49 [Bug c/102505] New: [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368 gscfq@t-online.de
` (8 preceding siblings ...)
2021-10-27 17:17 ` cvs-commit at gcc dot gnu.org
@ 2021-11-02 10:19 ` cvs-commit at gcc dot gnu.org
2021-11-02 12:29 ` jamborm at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-02 10:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102505
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Martin Jambor
<jamborm@gcc.gnu.org>:
https://gcc.gnu.org/g:7d398e42d3d4ded84cb7a86396c75c5aaf518283
commit r10-10249-g7d398e42d3d4ded84cb7a86396c75c5aaf518283
Author: Martin Jambor <mjambor@suse.cz>
Date: Tue Nov 2 11:17:51 2021 +0100
sra: Fix corner case of total scalarization with virtual inheritance (PR
102505)
PR 102505 is a situation where of SRA takes its initial top-level
access size from a get_ref_base_and_extent called on a COMPONENT_REF,
and thus derived frm the FIELD_DECL, which however does not include a
virtual base. Total scalarization then goes on traversing the type,
which however has virtual base past the non-virtual bits, tricking SRA
to create sub-accesses outside of the supposedly encompassing
accesses, which in turn triggers the verifier within the pass.
The patch below fixes that by failing total scalarization when this
situation is detected.
This backport also has commit f217e87972a2a207e793101fc05cfc9dd095c678
squashed into it in order to avoid PR 102886 that the fix introduced
on trunk.
gcc/ChangeLog:
2021-10-20 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/102505
* tree-sra.c (totally_scalarize_subtree): Check that the
encountered field fits within the acces we would like to put it
in.
gcc/testsuite/ChangeLog:
2021-10-20 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/102505
* g++.dg/torture/pr102505.C: New test.
(cherry picked from commit 701ee067807b80957c65bd7ff94b6099a27181de)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance since r10-6321-g636e80eea24b780f
2021-09-27 19:49 [Bug c/102505] New: [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368 gscfq@t-online.de
` (9 preceding siblings ...)
2021-11-02 10:19 ` cvs-commit at gcc dot gnu.org
@ 2021-11-02 12:29 ` jamborm at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jamborm at gcc dot gnu.org @ 2021-11-02 12:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102505
Martin Jambor <jamborm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Fixed on master and the gcc-10 and gcc-11 release branches.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-11-02 12:29 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 19:49 [Bug c/102505] New: [10/11/12 Regression] ICE in verify_sra_access_forest, at tree-sra.c:2368 gscfq@t-online.de
2021-09-27 19:49 ` [Bug c/102505] " gscfq@t-online.de
2021-09-27 22:01 ` [Bug tree-optimization/102505] " pinskia at gcc dot gnu.org
2021-09-28 8:36 ` [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance rguenth at gcc dot gnu.org
2021-09-30 9:52 ` [Bug tree-optimization/102505] [10/11/12 Regression] ICE in verify_sra_access_forest with 16 byte aligned field and virtual inheritance since r10-6321-g636e80eea24b780f marxin at gcc dot gnu.org
2021-10-07 15:48 ` jamborm at gcc dot gnu.org
2021-10-21 10:58 ` jamborm at gcc dot gnu.org
2021-10-21 12:56 ` cvs-commit at gcc dot gnu.org
2021-10-25 13:27 ` cvs-commit at gcc dot gnu.org
2021-10-27 17:17 ` cvs-commit at gcc dot gnu.org
2021-11-02 10:19 ` cvs-commit at gcc dot gnu.org
2021-11-02 12:29 ` 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).