public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dcb314 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/106907] New: gcc/config/rs6000/rs6000.cc:23155: strange expression ?
Date: Mon, 12 Sep 2022 11:08:30 +0000	[thread overview]
Message-ID: <bug-106907-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 106907
           Summary: gcc/config/rs6000/rs6000.cc:23155: strange expression
                    ?
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Static analyser cppcheck says:

gcc/config/rs6000/rs6000.cc:23155:16: style: Boolean result is used in bitwise
operation. Clarify expression with parentheses. [clarifyCondition]

Source code is

  fprintf (file, "\t  .amdhsa_system_vgpr_workitem_id\t%i\n",
       (cfun->machine->args.requested & (1 << WORK_ITEM_ID_Z_ARG))
       ? 2
       : cfun->machine->args.requested & (1 << WORK_ITEM_ID_Y_ARG)
       ? 1 : 0);

Maybe better code:

  fprintf (file, "\t  .amdhsa_system_vgpr_workitem_id\t%i\n",
       (cfun->machine->args.requested & (1 << WORK_ITEM_ID_Z_ARG))
       ? 2
       : (cfun->machine->args.requested & (1 << WORK_ITEM_ID_Y_ARG))
       ? 1 : 0);

             reply	other threads:[~2022-09-12 11:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 11:08 dcb314 at hotmail dot com [this message]
2022-09-12 11:14 ` [Bug target/106907] " dcb314 at hotmail dot com
2022-09-12 11:16 ` dcb314 at hotmail dot com
2022-09-12 11:28 ` schwab@linux-m68k.org
2023-05-30 15:43 ` jeevitha at gcc dot gnu.org
2023-06-06 11:22 ` cvs-commit at gcc dot gnu.org
2023-06-07 16:29 ` cvs-commit at gcc dot gnu.org
2023-06-09  8:49 ` cvs-commit at gcc dot gnu.org
2023-07-05  7:10 ` jeevitha at gcc dot gnu.org
2023-07-06  4:53 ` cvs-commit at gcc dot gnu.org
2023-10-30 10:43 ` cvs-commit at gcc dot gnu.org
2024-02-27 15:26 ` jeevitha 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-106907-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: 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).