https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124975
Bug ID: 124975
Summary: trans-expr.cc:11560: 2 * always true expression ?
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: ---
Source code is
if (remap->u.ar.start[dim]->expr_type != EXPR_CONSTANT
|| remap->u.ar.start[dim]->expr_type != EXPR_VARIABLE)
gfc_resolve_expr (remap->u.ar.start[dim]);
if (remap->u.ar.end[dim]->expr_type != EXPR_CONSTANT
|| remap->u.ar.end[dim]->expr_type != EXPR_VARIABLE)
gfc_resolve_expr (remap->u.ar.end[dim]);
Maybe better code:
if (remap->u.ar.start[dim]->expr_type != EXPR_CONSTANT
&& remap->u.ar.start[dim]->expr_type != EXPR_VARIABLE)
gfc_resolve_expr (remap->u.ar.start[dim]);
if (remap->u.ar.end[dim]->expr_type != EXPR_CONSTANT
&& remap->u.ar.end[dim]->expr_type != EXPR_VARIABLE)
gfc_resolve_expr (remap->u.ar.end[dim]);
git blame seems to think Paul Thomas wrote this code:
c5fa2108ce0f gcc/fortran/trans-expr.cc (Paul Thomas 2024-10-23
14:34:20 +0100 11557) if (remap->u.ar.start[dim]->expr_type !=
EXPR_CONSTANT
c5fa2108ce0f gcc/fortran/trans-expr.cc (Paul Thomas 2024-10-23
14:34:20 +0100 11558) || remap->u.ar.start[dim]->expr_type !=
EXPR_VARIABLE)
c5fa2108ce0f gcc/fortran/trans-expr.cc (Paul Thomas 2024-10-23
14:34:20 +0100 11559) gfc_resolve_expr (remap->u.ar.start[dim]);
c5fa2108ce0f gcc/fortran/trans-expr.cc (Paul Thomas 2024-10-23
14:34:20 +0100 11560) if (remap->u.ar.end[dim]->expr_type !=
EXPR_CONSTANT
c5fa2108ce0f gcc/fortran/trans-expr.cc (Paul Thomas 2024-10-23
14:34:20 +0100 11561) || remap->u.ar.end[dim]->expr_type !=
EXPR_VARIABLE)
c5fa2108ce0f gcc/fortran/trans-expr.cc (Paul Thomas 2024-10-23
14:34:20 +0100 11562) gfc_resolve_expr (remap->u.ar.end[dim]);
c5fa2108ce0f gcc/fortran/trans-expr.cc (Paul Thomas 2024-10-23
14:34:20 +0100 11563)