public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/115143] [11/12/13/14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85
Date: Sat, 18 May 2024 14:36:08 +0000	[thread overview]
Message-ID: <bug-115143-4-QgxQ1JlNCf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115143-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
here is one that is more correct to show the failure:
```
unsigned __GIMPLE (ssa,startwith("phiopt"))
foo (unsigned a, unsigned b)
{
  unsigned j;
  unsigned _23;
  unsigned _12;

  __BB(2):
  if (a_6(D) > 0u)
    goto __BB3;
  else
    goto __BB4;

  __BB(3):
  j_10 = __PHI (__BB2: b_7(D));
  _23 = __MIN (a_6(D), j_10);
  goto __BB4;

  __BB(4):
  _12 = __PHI (__BB3: _23, __BB2: 0u);
  return _12;
}
```

But note this does use the canonical form for the comparison; `a > 0u` is the
non-canonical form of `a != 0u` (for unsigned types). That is why it didn't
show up before. My patch (r14-3827-g30e6ee074588ba ) fixed the issue with the
way comparison was doing and exposed this latent bug. It was trying `j_10 >=
1u` before when it should have been doing `j_10 >= 0u` and that is the issue.

THIS only shows up with unsigned types because  `j_10 >= 0u` is always true and
it needed that to match the constant really.

Anyways my patch fixes the issue

  parent reply	other threads:[~2024-05-18 14:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17 21:29 [Bug tree-optimization/115143] New: [14/15 " patrick at rivosinc dot com
2024-05-18  2:00 ` [Bug tree-optimization/115143] " pinskia at gcc dot gnu.org
2024-05-18  2:22 ` pinskia at gcc dot gnu.org
2024-05-18 13:11 ` pinskia at gcc dot gnu.org
2024-05-18 13:12 ` [Bug tree-optimization/115143] [13/14/15 " pinskia at gcc dot gnu.org
2024-05-18 13:15 ` [Bug tree-optimization/115143] [11/12/13/14/15 " pinskia at gcc dot gnu.org
2024-05-18 13:27 ` pinskia at gcc dot gnu.org
2024-05-18 13:27 ` pinskia at gcc dot gnu.org
2024-05-18 14:04 ` pinskia at gcc dot gnu.org
2024-05-18 14:06 ` pinskia at gcc dot gnu.org
2024-05-18 14:10 ` pinskia at gcc dot gnu.org
2024-05-18 14:36 ` pinskia at gcc dot gnu.org [this message]
2024-05-18 23:12 ` pinskia at gcc dot gnu.org
2024-05-20 21:45 ` cvs-commit at gcc dot gnu.org
2024-05-20 21:57 ` cvs-commit at gcc dot gnu.org
2024-05-20 21:58 ` [Bug tree-optimization/115143] [11/12/13 " pinskia at gcc dot gnu.org
2024-05-21  9:20 ` jakub at gcc dot gnu.org
2024-05-21 14:32 ` cvs-commit at gcc dot gnu.org
2024-05-21 14:36 ` [Bug tree-optimization/115143] [11/12 " pinskia at gcc dot gnu.org
2024-06-11 17:19 ` cvs-commit at gcc dot gnu.org
2024-06-11 17:20 ` [Bug tree-optimization/115143] [11 " 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-115143-4-QgxQ1JlNCf@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).