public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/110431] New: Incorrect disambiguation of wide accesess from store-merging or SLP
@ 2023-06-27 9:45 amonakov at gcc dot gnu.org
2023-06-27 10:16 ` [Bug middle-end/110431] " rguenth at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: amonakov at gcc dot gnu.org @ 2023-06-27 9:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110431
Bug ID: 110431
Summary: Incorrect disambiguation of wide accesess from
store-merging or SLP
Product: gcc
Version: 12.3.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: amonakov at gcc dot gnu.org
Target Milestone: ---
Inspired by bug 110237 comment 19:
int b, a;
int main()
{
int *pa = &a, *pb = &b;
asm("" : "+r"(pa));
asm("" : "+r"(pb));
if (pa + 1 == pb) {
a = 1, b = 2;
long x;
__builtin_memcpy(&x, pa, 4);
__builtin_memcpy(4 + (char *)&x, pa+1, 4);
return (x - 0x0000000200000001) * 131 >> 32;
}
}
https://godbolt.org/z/b67zxMv54
On GIMPLE, both store-merging and SLP vectorization are capable of introducing
merged long-sized access in place of individual int-sized memcpy's, which is
then disambiguated against initial stores on the RTL level, leading to a
miscompilation.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug middle-end/110431] Incorrect disambiguation of wide accesess from store-merging or SLP
2023-06-27 9:45 [Bug middle-end/110431] New: Incorrect disambiguation of wide accesess from store-merging or SLP amonakov at gcc dot gnu.org
@ 2023-06-27 10:16 ` rguenth at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-27 10:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110431
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2023-06-27
CC| |rguenth at gcc dot gnu.org
Status|UNCONFIRMED |NEW
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I guess the provenance people would say this violates some rules since
pa + 1 is used to access 'b'. GCC itself is prone to introduce such
issues when propagating equivalences though.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-27 10:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27 9:45 [Bug middle-end/110431] New: Incorrect disambiguation of wide accesess from store-merging or SLP amonakov at gcc dot gnu.org
2023-06-27 10:16 ` [Bug middle-end/110431] " 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).