public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "slyfox at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/110228] [13/14 Regression] llvm-16 miscompiled due to an maybe uninitialized variable
Date: Tue, 04 Jul 2023 13:36:56 +0000 [thread overview]
Message-ID: <bug-110228-4-4MSILCmPNJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110228-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110228
--- Comment #32 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #29)
> I can't reproduce the original failure on trunk or with GCC 13.1, but the
> testcase from comment#16 is now fixed. I also cannot reproduce the testcase
> from comment#21 before the fix.
>
> Can people double-check this is now fixed, maybe also on the branch when this
> fix is cherry-picked?
Test suite on llvm-16 still fails the same single 'LLVM ::
ExecutionEngine/JITLink/X86/MachO_weak_references.s' test for me.
gcc was built from 2c12ccf800fc7890925402d30a02f0fa9e2627cc.
The following test still fails for me:
$ cat bug.c
static unsigned a[4] = {1,1,1,1};
__attribute__((noipa))
static void bug(unsigned * p, unsigned *t, int n) {
unsigned LookupFlags;
for(int i = 0; i < n; i++) {
unsigned v = t[i];
if (v == 0) LookupFlags = 0;
else if (v == 1) LookupFlags = 1;
*p = LookupFlags;
}
}
int main() {
unsigned r = 42;
bug(&r, a, 4);
if (r != 1) __builtin_abort();
return 0;
}
$ gcc bug.c -o bug -O1 -Wall && ./bug
bug.c: In function 'bug':
bug.c:10:15: warning: 'LookupFlags' may be used uninitialized
[-Wmaybe-uninitialized]
10 | else if (v == 1) LookupFlags = 1;
| ^
bug.c:5:15: note: 'LookupFlags' was declared here
5 | unsigned LookupFlags;
| ^~~~~~~~~~~
Aborted (core dumped)
bug.c.255t.optimized still turns stores into '|=' against uninit value:
__attribute__((noipa, noinline, noclone, no_icf))
void bug (unsigned int * p, unsigned int * t, int n)
{
unsigned long ivtmp.8;
unsigned int v;
unsigned int LookupFlags;
_Bool _16;
unsigned int _17;
unsigned int _18;
void * _19;
unsigned long _20;
unsigned long _26;
unsigned long _28;
<bb 2> [local count: 118111600]:
if (n_10(D) > 0)
goto <bb 3>; [89.00%]
else
goto <bb 7>; [11.00%]
<bb 3> [local count: 105119324]:
ivtmp.8_21 = (unsigned long) t_11(D);
_20 = (unsigned long) n_10(D);
_26 = _20 * 4;
_28 = ivtmp.8_21 + _26;
<bb 4> [local count: 955630225]:
# LookupFlags_22 = PHI <LookupFlags_4(6), LookupFlags_8(D)(3)>
# ivtmp.8_6 = PHI <ivtmp.8_5(6), ivtmp.8_21(3)>
_19 = (void *) ivtmp.8_6;
v_12 = MEM[(unsigned int *)_19];
if (v_12 == 0)
goto <bb 6>; [50.00%]
else
goto <bb 5>; [50.00%]
<bb 5> [local count: 477815112]:
_16 = v_12 == 1;
_17 = (unsigned int) _16;
_18 = _17 | LookupFlags_22;
<bb 6> [local count: 955630225]:
# LookupFlags_4 = PHI <v_12(4), _18(5)>
*p_13(D) = LookupFlags_4;
ivtmp.8_5 = ivtmp.8_6 + 4;
if (ivtmp.8_5 != _28)
goto <bb 4>; [89.00%]
else
goto <bb 7>; [11.00%]
<bb 7> [local count: 118111600]:
return;
}
next prev parent reply other threads:[~2023-07-04 13:36 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 17:19 [Bug middle-end/110228] New: [14 Regression] llvm-16 miscompilation on small case switch, minimized slyfox at gcc dot gnu.org
2023-06-12 17:27 ` [Bug middle-end/110228] " pinskia at gcc dot gnu.org
2023-06-12 17:30 ` pinskia at gcc dot gnu.org
2023-06-12 17:32 ` pinskia at gcc dot gnu.org
2023-06-12 17:39 ` pinskia at gcc dot gnu.org
2023-06-12 17:45 ` pinskia at gcc dot gnu.org
2023-06-12 17:49 ` pinskia at gcc dot gnu.org
2023-06-12 19:03 ` [Bug middle-end/110228] [14 Regression] llvm-16 miscompiled due to an maybe uninitialized and optimizations saying that the uninitialized has a nonzero bits of 1 pinskia at gcc dot gnu.org
2023-06-12 19:17 ` pinskia at gcc dot gnu.org
2023-06-15 4:50 ` pinskia at gcc dot gnu.org
2023-06-16 22:18 ` pinskia at gcc dot gnu.org
2023-06-16 22:23 ` pinskia at gcc dot gnu.org
2023-06-17 17:52 ` pinskia at gcc dot gnu.org
2023-06-17 20:52 ` pinskia at gcc dot gnu.org
2023-06-17 20:56 ` slyfox at gcc dot gnu.org
2023-06-17 21:04 ` jakub at gcc dot gnu.org
2023-06-17 21:38 ` [Bug middle-end/110228] [13/14 " pinskia at gcc dot gnu.org
2023-06-20 8:38 ` aldyh at gcc dot gnu.org
2023-06-24 0:01 ` [Bug middle-end/110228] [13/14 Regression] llvm-16 miscompiled due to an maybe uninitialized variable pinskia at gcc dot gnu.org
2023-06-30 2:19 ` pinskia at gcc dot gnu.org
2023-07-01 5:24 ` pinskia at gcc dot gnu.org
2023-07-01 21:37 ` zhendong.su at inf dot ethz.ch
2023-07-01 21:40 ` pinskia at gcc dot gnu.org
2023-07-01 21:50 ` pinskia at gcc dot gnu.org
2023-07-03 21:04 ` slyfox at gcc dot gnu.org
2023-07-03 21:52 ` slyfox at gcc dot gnu.org
2023-07-04 6:33 ` rguenth at gcc dot gnu.org
2023-07-04 6:54 ` rguenth at gcc dot gnu.org
2023-07-04 9:15 ` cvs-commit at gcc dot gnu.org
2023-07-04 9:18 ` rguenth at gcc dot gnu.org
2023-07-04 10:06 ` zhendong.su at inf dot ethz.ch
2023-07-04 10:28 ` rguenth at gcc dot gnu.org
2023-07-04 13:36 ` slyfox at gcc dot gnu.org [this message]
2023-07-04 13:41 ` rguenther at suse dot de
2023-07-04 15:11 ` slyfox at gcc dot gnu.org
2023-07-05 7:29 ` [Bug middle-end/110228] [13 " rguenth at gcc dot gnu.org
2023-07-05 8:23 ` cvs-commit at gcc dot gnu.org
2023-07-05 8:24 ` rguenth at gcc dot gnu.org
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-110228-4-4MSILCmPNJ@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: link
Be 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).