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

            Bug ID: 124257
           Summary: gcc/fortran/trans-decl.cc:1153: Array index check in
                    wrong place ?
           Product: gcc
           Version: 16.0
            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.cc:1153:11: style: Array index 'dim' is used before
limits check. [arrayIndexThenCheck]

Source code is

      if (GFC_TYPE_ARRAY_UBOUND (type, dim) == NULL_TREE
          && dim < GFC_TYPE_ARRAY_RANK (type) + GFC_TYPE_ARRAY_CORANK (type) -
1)

Suggest move limits check to before use.

Reply via email to