public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99616] New: gcc/cp/decl.c:12220: pointless test ?
@ 2021-03-16 11:29 dcb314 at hotmail dot com
  2021-03-16 12:22 ` [Bug c++/99616] " marxin at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dcb314 at hotmail dot com @ 2021-03-16 11:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99616
           Summary: gcc/cp/decl.c:12220: pointless test ?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

cppcheck says:

trunk.git/gcc/cp/decl.c:12214:15: warning: Either the condition
'declarator==NULL' is redundant or there is possible null pointer dereference:
declarator. [nullPointerRedundantCheck]
trunk.git/gcc/cp/decl.c:12222:8: warning: Either the condition
'declarator==NULL' is redundant or there is possible null pointer dereference:
declarator. [nullPointerRedundantCheck]
trunk.git/gcc/cp/decl.c:12224:8: warning: Either the condition
'declarator==NULL' is redundant or there is possible null pointer dereference:
declarator. [nullPointerRedundantCheck]

Since

  for (; declarator; declarator = declarator->declarator)

then this looks redundant:

          if (declarator == NULL || declarator->kind == cdk_id)

Maybe better code

          if (declarator->kind == cdk_id)

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

* [Bug c++/99616] gcc/cp/decl.c:12220: pointless test ?
  2021-03-16 11:29 [Bug c++/99616] New: gcc/cp/decl.c:12220: pointless test ? dcb314 at hotmail dot com
@ 2021-03-16 12:22 ` marxin at gcc dot gnu.org
  2021-03-18  9:45 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-16 12:22 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
                 CC|                            |marxin at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2021-03-16
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Yes, the check is redundant. Let me work on that.

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

* [Bug c++/99616] gcc/cp/decl.c:12220: pointless test ?
  2021-03-16 11:29 [Bug c++/99616] New: gcc/cp/decl.c:12220: pointless test ? dcb314 at hotmail dot com
  2021-03-16 12:22 ` [Bug c++/99616] " marxin at gcc dot gnu.org
@ 2021-03-18  9:45 ` marxin at gcc dot gnu.org
  2021-05-10  7:20 ` cvs-commit at gcc dot gnu.org
  2021-05-10  7:21 ` marxin at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-18  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

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

* [Bug c++/99616] gcc/cp/decl.c:12220: pointless test ?
  2021-03-16 11:29 [Bug c++/99616] New: gcc/cp/decl.c:12220: pointless test ? dcb314 at hotmail dot com
  2021-03-16 12:22 ` [Bug c++/99616] " marxin at gcc dot gnu.org
  2021-03-18  9:45 ` marxin at gcc dot gnu.org
@ 2021-05-10  7:20 ` cvs-commit at gcc dot gnu.org
  2021-05-10  7:21 ` marxin at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-10  7:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r12-650-gec728fb0026bbe5bc9f0d9ccb4215000f77ab206
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Mar 16 13:22:55 2021 +0100

    c++: remove redundand NULL check.

    gcc/cp/ChangeLog:

            PR c++/99616
            * decl.c (grokdeclarator): Remove redundant NULL check.

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

* [Bug c++/99616] gcc/cp/decl.c:12220: pointless test ?
  2021-03-16 11:29 [Bug c++/99616] New: gcc/cp/decl.c:12220: pointless test ? dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2021-05-10  7:20 ` cvs-commit at gcc dot gnu.org
@ 2021-05-10  7:21 ` marxin at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-05-10  7:21 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-05-10  7:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16 11:29 [Bug c++/99616] New: gcc/cp/decl.c:12220: pointless test ? dcb314 at hotmail dot com
2021-03-16 12:22 ` [Bug c++/99616] " marxin at gcc dot gnu.org
2021-03-18  9:45 ` marxin at gcc dot gnu.org
2021-05-10  7:20 ` cvs-commit at gcc dot gnu.org
2021-05-10  7:21 ` marxin 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).