[Bug fortran/95512] New: gcc/fortran/trans-decl.c:1066: array sanity check after use
dcb314 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 3 19:46:33 GMT 2020
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)
More information about the Gcc-bugs
mailing list