public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/106907] New: gcc/config/rs6000/rs6000.cc:23155: strange expression ?
@ 2022-09-12 11:08 dcb314 at hotmail dot com
  2022-09-12 11:14 ` [Bug target/106907] " dcb314 at hotmail dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: dcb314 at hotmail dot com @ 2022-09-12 11:08 UTC (permalink / raw)
  To: gcc-bugs

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);

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-02-27 15:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12 11:08 [Bug target/106907] New: gcc/config/rs6000/rs6000.cc:23155: strange expression ? dcb314 at hotmail dot com
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

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).