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

* [Bug target/106907] gcc/config/rs6000/rs6000.cc:23155: strange expression ?
  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 ` dcb314 at hotmail dot com
  2022-09-12 11:16 ` dcb314 at hotmail dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dcb314 at hotmail dot com @ 2022-09-12 11:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
Wrong source code. It should be:

     if (swapped ^ !BYTES_BIG_ENDIAN
          && icode != CODE_FOR_vsx_xxpermdi_v16qi)

That looks like it could benefit from some ( and ).

The source code I did mention produces this message:

gcc/config/gcn/gcn.cc:5563:5: style: Clarify calculation precedence for '&' and
'?'. [clarifyCalculation]

So two bugs reports in one.

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

* [Bug target/106907] gcc/config/rs6000/rs6000.cc:23155: strange expression ?
  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
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dcb314 at hotmail dot com @ 2022-09-12 11:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from David Binderman <dcb314 at hotmail dot com> ---
In the same file rs6000.cc, cppcheck produces:

gcc/config/rs6000/rs6000.cc:28477:8: style: Same expression on both sides of
'&&'. [duplicateExpression]

Source code is

  info->all_words_same
    = (info->words[0] == info->words[1]
       && info->words[0] == info->words[1]
       && info->words[0] == info->words[2]
       && info->words[0] == info->words[3]);

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

* [Bug target/106907] gcc/config/rs6000/rs6000.cc:23155: strange expression ?
  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
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: schwab@linux-m68k.org @ 2022-09-12 11:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> ---
Should probably be written as swapped != !BYTES_BIG_ENDIAN.

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

* [Bug target/106907] gcc/config/rs6000/rs6000.cc:23155: strange expression ?
  2022-09-12 11:08 [Bug target/106907] New: gcc/config/rs6000/rs6000.cc:23155: strange expression ? dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jeevitha at gcc dot gnu.org @ 2023-05-30 15:43 UTC (permalink / raw)
  To: gcc-bugs

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

Jeevitha <jeevitha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jeevitha at gcc dot gnu.org

--- Comment #4 from Jeevitha <jeevitha at gcc dot gnu.org> ---
(In reply to Andreas Schwab from comment #3)
> Should probably be written as swapped != !BYTES_BIG_ENDIAN.

I bootstrapped and regtest there is no regression with this change.

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

* [Bug target/106907] gcc/config/rs6000/rs6000.cc:23155: strange expression ?
  2022-09-12 11:08 [Bug target/106907] New: gcc/config/rs6000/rs6000.cc:23155: strange expression ? dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-06 11:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by jeevitha <jeevitha@gcc.gnu.org>:

https://gcc.gnu.org/g:c4deccd44655c5d748dfed200a37f2b678c32fe8

commit r14-1567-gc4deccd44655c5d748dfed200a37f2b678c32fe8
Author: Jeevitha Palanisamy <jeevitha@linux.ibm.com>
Date:   Tue Jun 6 06:19:02 2023 -0500

    rs6000: Remove duplicate expression [PR106907]

    PR106907 has few warnings spotted from cppcheck. In that addressing
duplicate
    expression issue here. Here the same expression is used twice in logical
    AND(&&) operation which result in same result so removing that.

    2023-06-06  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>

    gcc/
            PR target/106907
            * config/rs6000/rs6000.cc (vec_const_128bit_to_bytes): Remove
            duplicate expression.

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

* [Bug target/106907] gcc/config/rs6000/rs6000.cc:23155: strange expression ?
  2022-09-12 11:08 [Bug target/106907] New: gcc/config/rs6000/rs6000.cc:23155: strange expression ? dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-07 16:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by jeevitha <jeevitha@gcc.gnu.org>:

https://gcc.gnu.org/g:dda4745eb1c9b063c6004baef54aa4cec97edf3d

commit r13-7426-gdda4745eb1c9b063c6004baef54aa4cec97edf3d
Author: Jeevitha Palanisamy <jeevitha@linux.ibm.com>
Date:   Tue Jun 6 06:19:02 2023 -0500

    rs6000: Remove duplicate expression [PR106907]

    PR106907 has few warnings spotted from cppcheck. In that addressing
duplicate
    expression issue here. Here the same expression is used twice in logical
    AND(&&) operation which result in same result so removing that.

    2023-06-06  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>

    gcc/
            PR target/106907
            * config/rs6000/rs6000.cc (vec_const_128bit_to_bytes): Remove
            duplicate expression.

    (cherry picked from commit c4deccd44655c5d748dfed200a37f2b678c32fe8)

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

* [Bug target/106907] gcc/config/rs6000/rs6000.cc:23155: strange expression ?
  2022-09-12 11:08 [Bug target/106907] New: gcc/config/rs6000/rs6000.cc:23155: strange expression ? dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-09  8:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by jeevitha <jeevitha@gcc.gnu.org>:

https://gcc.gnu.org/g:3b09a5453114fee10b0f0984793ce968503dbea7

commit r12-9689-g3b09a5453114fee10b0f0984793ce968503dbea7
Author: Jeevitha Palanisamy <jeevitha@linux.ibm.com>
Date:   Tue Jun 6 06:19:02 2023 -0500

    rs6000: Remove duplicate expression [PR106907]

    PR106907 has few warnings spotted from cppcheck. In that addressing
duplicate
    expression issue here. Here the same expression is used twice in logical
    AND(&&) operation which result in same result so removing that.

    2023-06-06  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>

    gcc/
            PR target/106907
            * config/rs6000/rs6000.cc (vec_const_128bit_to_bytes): Remove
            duplicate expression.

    (cherry picked from commit c4deccd44655c5d748dfed200a37f2b678c32fe8)

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

* [Bug target/106907] gcc/config/rs6000/rs6000.cc:23155: strange expression ?
  2022-09-12 11:08 [Bug target/106907] New: gcc/config/rs6000/rs6000.cc:23155: strange expression ? dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jeevitha at gcc dot gnu.org @ 2023-07-05  7:10 UTC (permalink / raw)
  To: gcc-bugs

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

Jeevitha <jeevitha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |linkw at gcc dot gnu.org

--- Comment #8 from Jeevitha <jeevitha at gcc dot gnu.org> ---
Static analyser cppcheck says:

gcc/config/rs6000/rs6000.cc:7668:16: style: Redundant initialization for
'new_addr'. The initialized value is overwritten before it is read.
[redundantInitialization]
      new_addr = gen_rtx_PLUS (Pmode, XEXP (mem, 0), elt);
               ^
rs6000.cc:7663:20: note: new_addr is initialized
      rtx new_addr = gen_reg_rtx (Pmode);
                   ^
rs6000.cc:7668:16: note: new_addr is overwritten
      new_addr = gen_rtx_PLUS (Pmode, XEXP (mem, 0), elt);
               ^

In above issue new_addr was initialized at line no : 7663 which was overwritten
before it reads at line no : 7668

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

* [Bug target/106907] gcc/config/rs6000/rs6000.cc:23155: strange expression ?
  2022-09-12 11:08 [Bug target/106907] New: gcc/config/rs6000/rs6000.cc:23155: strange expression ? dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  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
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-06  4:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by jeevitha <jeevitha@gcc.gnu.org>:

https://gcc.gnu.org/g:1669fad496ed6cc7ddea142e12af15e0b9f7f3b4

commit r14-2336-g1669fad496ed6cc7ddea142e12af15e0b9f7f3b4
Author: Jeevitha Palanisamy <jeevitha@linux.ibm.com>
Date:   Wed Jul 5 23:46:15 2023 -0500

    rs6000: Remove redundant initialization [PR106907]

    PR106907 has few warnings spotted from cppcheck. In that addressing
    redundant initialization issue. Here the initialized value of 'new_addr'
    was overwritten before it was read. Updated the source by removing the
    unnecessary initialization of 'new_addr'.

    2023-07-06  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>

    gcc/
            PR target/106907
            * config/rs6000/rs6000.cc (rs6000_expand_vector_extract): Remove
redundant
            initialization of new_addr.

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

* [Bug target/106907] gcc/config/rs6000/rs6000.cc:23155: strange expression ?
  2022-09-12 11:08 [Bug target/106907] New: gcc/config/rs6000/rs6000.cc:23155: strange expression ? dcb314 at hotmail dot com
                   ` (8 preceding siblings ...)
  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
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-30 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by jeevitha <jeevitha@gcc.gnu.org>:

https://gcc.gnu.org/g:36a52cdc23383e51359630e566b62fa62011428d

commit r14-5006-g36a52cdc23383e51359630e566b62fa62011428d
Author: Jeevitha <jeevitha@linux.ibm.com>
Date:   Mon Oct 30 04:07:07 2023 -0500

    rs6000: Change bitwise xor to an equality operator [PR106907]

    PR106907 has a few warnings spotted from cppcheck. These warnings
    are related to the need of precedence clarification. Instead of using xor,
    it has been changed to equality check, which achieves the same result.
    Additionally, comment indentation has been fixed.

    2023-10-11  Jeevitha Palanisamy  <jeevitha@linux.ibm.com>

    gcc/
            PR target/106907
            * config/rs6000/rs6000.cc (altivec_expand_vec_perm_const): Change
bitwise
            xor to an equality and fix comment indentation.

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

* [Bug target/106907] gcc/config/rs6000/rs6000.cc:23155: strange expression ?
  2022-09-12 11:08 [Bug target/106907] New: gcc/config/rs6000/rs6000.cc:23155: strange expression ? dcb314 at hotmail dot com
                   ` (9 preceding siblings ...)
  2023-10-30 10:43 ` cvs-commit at gcc dot gnu.org
@ 2024-02-27 15:26 ` jeevitha at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jeevitha at gcc dot gnu.org @ 2024-02-27 15:26 UTC (permalink / raw)
  To: gcc-bugs

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

Jeevitha <jeevitha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #11 from Jeevitha <jeevitha at gcc dot gnu.org> ---
Fixed

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