public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/109462] [13 Regression] Possible miscompilation of clang LocalizationChecker since r13-1938
Date: Tue, 11 Apr 2023 12:56:48 +0000	[thread overview]
Message-ID: <bug-109462-4-5pkdjwjyBG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109462-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I have tried
struct Token {
  unsigned char pad[4];
  unsigned int uintdata;
  unsigned long ptrdata;
  unsigned short kind;
  unsigned char pad2[6];
  Token () : uintdata (0), ptrdata (0), kind (0) {}
  unsigned short getKind () { return kind; }
  unsigned int getLength () { return uintdata; }
  unsigned long getLiteralData () { return ptrdata; }
};
bool bar (Token &);
bool baz (unsigned long, unsigned int);
void qux ();
static inline bool
isStringLiteral (unsigned short K)
{
  return ((unsigned short) (K + 65523U) <= 1 || K == 16 || (unsigned short) (K
+ 65519U) <= 1);
}

void
foo ()
{
  Token I;
  Token Result;
  int p_count = 0;
  while (!bar (I)) {
    if (I.getKind () == 21)
      ++p_count;
    if (I.getKind () == 22) {
      if (p_count == 1)
        break;
      --p_count;
    }
    Result = I;
  }
  if (Result.getKind () == 5 || Result.getKind () == 6)
    {
      if (baz (Result.getLiteralData (), Result.getLength ()))
        {
          qux ();
          return;
        }
    }
  if (!isStringLiteral (Result.getKind ()))
    return;
  baz (Result.getLiteralData (), Result.getLength ());
  __builtin_abort ();
}
but while that results in very similar IL, it doesn't reproduce that.

  parent reply	other threads:[~2023-04-11 12:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-10 10:32 [Bug tree-optimization/109462] New: " jakub at gcc dot gnu.org
2023-04-10 10:32 ` [Bug tree-optimization/109462] " jakub at gcc dot gnu.org
2023-04-10 10:37 ` pinskia at gcc dot gnu.org
2023-04-10 11:13 ` jakub at gcc dot gnu.org
2023-04-11 12:13 ` jakub at gcc dot gnu.org
2023-04-11 12:56 ` jakub at gcc dot gnu.org [this message]
2023-04-11 20:14 ` amacleod at redhat dot com
2023-04-11 21:23 ` amacleod at redhat dot com
2023-04-12  7:49 ` jakub at gcc dot gnu.org
2023-04-12  7:50 ` jakub at gcc dot gnu.org
2023-04-12 13:10 ` cvs-commit at gcc dot gnu.org
2023-04-12 14:23 ` cvs-commit at gcc dot gnu.org
2023-04-12 14:42 ` marxin at gcc dot gnu.org
2023-04-12 15:20 ` jakub at gcc dot gnu.org
2023-04-13 18:12 ` cvs-commit 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-109462-4-5pkdjwjyBG@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).