public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jwzeng at nuaa dot edu.cn" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/111290] New: [11/12/13/14 Regression] Wrong code at -O0 on x86_64-pc-linux-gnu Date: Tue, 05 Sep 2023 06:20:59 +0000 [thread overview] Message-ID: <bug-111290-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111290 Bug ID: 111290 Summary: [11/12/13/14 Regression] Wrong code at -O0 on x86_64-pc-linux-gnu Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: jwzeng at nuaa dot edu.cn Target Milestone: --- Compiler Explorer: https://godbolt.org/z/Ee3fMoqPr The following code snippet, gcc at -O0 produces the wrong code. I tested it on other versions of gcc and found that this bug was introduced starting from `gcc-4.9.0`. $ cat test.c #include <stdint.h> int printf(const char *, ...); volatile uint16_t a = (unsigned short)27267; volatile int32_t b = 191725925; volatile int32_t c = 633417204; volatile uint64_t d = 6049561019410052129ULL; volatile int32_t e = 2024295172; volatile int8_t res = (signed char)108; int main() { b = (c |= d / a) >= ((e %= 0x6B1D8456) > (res ^= c)); printf("%d\n", res); } $ $ gcc-tk test.c; ./a.out -104 $ gcc-4.9.0 test.c; ./a.out -104 $ gcc-4.8.5 test.c; ./a.out -112 $ clang-tk test.c; ./a.out -112 $ ccomp test.c; ./a.out -112 $ $ gcc-tk --version gcc (GCC) 14.0.0 20230829 (experimental) [master r14-3534-gebffc840f5] Copyright (C) 2023 Free Software Foundation, Inc. $ $ gcc-4.9.0 --version gcc (GCC) 4.9.0 Copyright (C) 2014 Free Software Foundation, Inc. $ $ gcc-4.8.5 --version gcc (GCC) 4.8.5 Copyright (C) 2015 Free Software Foundation, Inc. $ $ clang-tk --version Ubuntu clang version 18.0.0 (++20230821052626+634b2fd2cac2-1~exp1~20230821172748.738) Target: x86_64-pc-linux-gnu $ $ ccomp --version The CompCert C verified compiler, version 3.12
next reply other threads:[~2023-09-05 6:21 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-05 6:20 jwzeng at nuaa dot edu.cn [this message] 2023-09-05 6:45 ` [Bug middle-end/111290] " pinskia at gcc dot gnu.org 2023-09-05 6:49 ` pinskia 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-111290-4@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).