From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8BFF0385840D; Thu, 1 Jun 2023 14:02:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BFF0385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685628152; bh=SQez2S5NtnjE4NYXp3S/TojAlHq/PRpme4stfaUv/lE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HB5TajKdjExs2FQmcpZhHiBL5N9eHx+/P5+nqUW8gF77gEzTyywDPQ5BsT+KVBmsq 4Li07QrJyp3P7XRFjaK7L2Q+vmrlAE+D+XkjdQHXlj5OB3OsXmkvixRpRrDxs4/SGR DNGcnriNBf/0OsbV4bhBQ8jBw8ehs1FWVUD9dRWA= From: "theodort at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110080] [13/14 Regression] Missed Dead Code Elimination at -Os when using __builtin_unreachable since r13-6945-g429a7a88438 Date: Thu, 01 Jun 2023 14:02:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: theodort at inf dot ethz.ch X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110080 --- Comment #1 from Theodoros Theodoridis --- Oops, the first code snippet is wrong in the original post:=20 void foo(void); static unsigned char a =3D 131; static int *b; static int **c =3D &b; static void d(int e, unsigned f) { int *g; if (!e){ // <------------------------ if (!e) is correct for (; a; ++a) for (e =3D 0; 0;) ; g =3D &e; int **h =3D &g; if (**h) { foo(); } } *c =3D &e; } int main() { d(4 & a, a); } this is also the correct assembly for gcc trunk/13.1/12.3 at -Os: main: movb a(%rip), %al testb $4, %al jne .L5 xorl %edx, %edx .L2: testb %al, %al je .L12 incl %eax movb $1, %dl jmp .L2 .L12: testb %dl, %dl je .L5 movb $0, a(%rip) .L5: leaq -4(%rsp), %rax movq %rax, b(%rip) xorl %eax, %eax ret a: .byte -125 the code with the _builtin_unreachable and the rest are correct=