public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95512] New: gcc/fortran/trans-decl.c:1066: array sanity check after use
@ 2020-06-03 19:46 dcb314 at hotmail dot com
  2020-06-05 21:24 ` [Bug fortran/95512] " anlauf at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dcb314 at hotmail dot com @ 2020-06-03 19:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95512
           Summary: gcc/fortran/trans-decl.c:1066: array sanity check
                    after use
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Static analyser cppcheck says:

gcc/fortran/trans-decl.c:1066:11: style: Array index 'dim' is used before
limits check. [arrayIndexThenCheck]

Source code is

      /* Don't try to use the unknown ubound for the last coarray dimension. 
*/
      if (GFC_TYPE_ARRAY_UBOUND (type, dim) == NULL_TREE
          && dim < GFC_TYPE_ARRAY_RANK (type) + GFC_TYPE_ARRAY_CORANK (type) -
1)

Maybe better code:

      /* Don't try to use the unknown ubound for the last coarray dimension. 
*/
      if (dim < GFC_TYPE_ARRAY_RANK (type) + GFC_TYPE_ARRAY_CORANK (type) - 1
          && GFC_TYPE_ARRAY_UBOUND (type, dim) == NULL_TREE)

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

end of thread, other threads:[~2020-06-14 12:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 19:46 [Bug fortran/95512] New: gcc/fortran/trans-decl.c:1066: array sanity check after use dcb314 at hotmail dot com
2020-06-05 21:24 ` [Bug fortran/95512] " anlauf at gcc dot gnu.org
2020-06-06  6:26 ` dcb314 at hotmail dot com
2020-06-06 19:59 ` anlauf at gcc dot gnu.org
2020-06-06 20:42 ` dcb314 at hotmail dot com
2020-06-14 12:54 ` tkoenig 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).