public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gabravier at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107115] Wrong codegen from TBAA under stores that change effective type? Date: Tue, 27 Dec 2022 22:19:12 +0000 [thread overview] Message-ID: <bug-107115-4-pNZxjmnWd8@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107115-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107115 Gabriel Ravier <gabravier at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gabravier at gmail dot com --- Comment #13 from Gabriel Ravier <gabravier at gmail dot com> --- Idk if it qualifies as the same bug or if this will prove to bee particularly useful, but just to make sure the corresponding issue in C++, triggered by this slightly altered code (so that it hopefully respects the stricter rules C++ has w.r.t. implicit object creation) which also fails to execute correctly on GCC, is fixed by the fix to this issue, I'll post here the corresponding code: #include <new> #include <stdio.h> #include <stdlib.h> void test1(long *p1) { p1 = (long *)new ((char*)p1) char[sizeof(long)]; p1[0] = 1; } long test2(long long *p2, int index1, int index2) { p2 = (long long *)new ((char*)p2) char[sizeof(long long)]; p2[index1] = 2; return p2[index2]; } long test3(long *p3, int index2, long value) { p3 = (long *)new ((char*)p3) char[sizeof(long)]; p3[index2] = 3; p3[index2] = value; return p3[0]; } long test4(void *p4, int index1, int index2) { test1((long *)p4); long temp = test2((long long *)p4, index1, index2); return test3((long *)p4, index2, temp); } long (*volatile vtest)(void *, int, int) = test4; int main(void) { void *pp = malloc(sizeof(long long)); if (!pp) abort(); long result = vtest(pp, 0, 0); printf("%lu/%lu\n", *std::launder((long *)pp), result); }
next prev parent reply other threads:[~2022-12-27 22:19 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-01 20:00 [Bug middle-end/107115] New: " bugdal at aerifal dot cx 2022-10-01 23:34 ` [Bug rtl-optimization/107115] " pinskia at gcc dot gnu.org 2022-10-01 23:51 ` [Bug middle-end/107115] " pinskia at gcc dot gnu.org 2022-10-06 9:44 ` rguenth at gcc dot gnu.org 2022-10-06 12:20 ` cvs-commit at gcc dot gnu.org 2022-10-06 12:24 ` rguenth at gcc dot gnu.org 2022-10-06 15:19 ` amonakov at gcc dot gnu.org 2022-10-06 15:32 ` jakub at gcc dot gnu.org 2022-10-06 15:39 ` amonakov at gcc dot gnu.org 2022-10-06 19:04 ` pinskia at gcc dot gnu.org 2022-10-07 7:41 ` rguenth at gcc dot gnu.org 2022-10-07 7:44 ` rguenth at gcc dot gnu.org 2022-10-07 13:19 ` amonakov at gcc dot gnu.org 2022-12-27 22:19 ` gabravier at gmail dot com [this message] 2022-12-27 22:21 ` gabravier at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-107115-4-pNZxjmnWd8@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).