public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/109650] avr-gcc incorrect code with -Os
Date: Sat, 29 Apr 2023 09:05:01 +0000	[thread overview]
Message-ID: <bug-109650-4-MyWb8Xw3u9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109650-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109650

--- Comment #5 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Created attachment 54956
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54956&action=edit
pr109650-2.c: A simpler C test case without assembly.

Again, this testcase triggers with avr-gcc -Os:

typedef _Bool bool;
typedef __UINT8_TYPE__ uint8_t;

static inline __attribute__((__always_inline__))
bool func1 (uint8_t p1, uint8_t p2)
{
    if (p1)
        return p2 <= 8;
    return p2 <= 2;
}

__attribute__((__noinline__, __noclone__))
bool func2 (uint8_t p1, uint8_t p2)
{
    return func1 (p1, p2);
}

int main (void)
{
    if (func1 (0, 1) != func2 (0, 1)) __builtin_abort();
    if (func1 (0, 2) != func2 (0, 2)) __builtin_abort();
    if (func1 (0, 3) != func2 (0, 3)) __builtin_abort();

    if (func1 (1, 7) != func2 (1, 7)) __builtin_abort();
    if (func1 (1, 8) != func2 (1, 8)) __builtin_abort();
    if (func1 (1, 9) != func2 (1, 9)) __builtin_abort();

    __builtin_exit (0);
}

  parent reply	other threads:[~2023-04-29  9:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-27 17:13 [Bug c/109650] New: " thierer at web dot de
2023-04-27 17:26 ` [Bug target/109650] " pinskia at gcc dot gnu.org
2023-04-28 15:09 ` gjl at gcc dot gnu.org
2023-04-28 15:13 ` gjl at gcc dot gnu.org
2023-04-28 15:14 ` [Bug other/109650] " gjl at gcc dot gnu.org
2023-04-29  9:05 ` gjl at gcc dot gnu.org [this message]
2023-05-02 16:46 ` [Bug middle-end/109650] " gjl at gcc dot gnu.org
2023-05-03 16:57 ` [Bug target/109650] " gjl at gcc dot gnu.org
2023-05-19  8:31 ` gjl at gcc dot gnu.org
2023-05-19  8:52 ` gjl at gcc dot gnu.org
2023-06-10 19:59 ` cvs-commit at gcc dot gnu.org
2023-06-10 20:25 ` cvs-commit at gcc dot gnu.org
2023-06-10 20:46 ` cvs-commit at gcc dot gnu.org
2023-06-10 21:08 ` gjl at gcc dot gnu.org
2023-06-10 21:13 ` gjl 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-109650-4-MyWb8Xw3u9@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).