From: Sandra Loosemore Date: Sat, 4 Jul 2026 13:58:42 +0000 (+0000) Subject: Fortran: Fix ICE-on-invalid in trans_code. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f2c4cacfcdf9f6ed77ded6467df31cc90181e07;p=thirdparty%2Fgcc.git Fortran: Fix ICE-on-invalid in trans_code. gcc/fortran/ChangeLog * trans.cc (trans_code): Do not try to set location on non-expr tree expressions, e.g. error_mark_node. --- diff --git a/gcc/fortran/trans.cc b/gcc/fortran/trans.cc index b2ea499bbbe..51252561b2e 100644 --- a/gcc/fortran/trans.cc +++ b/gcc/fortran/trans.cc @@ -2697,7 +2697,9 @@ trans_code (gfc_code * code, tree cond) if (res != NULL_TREE && ! IS_EMPTY_STMT (res)) { - if (TREE_CODE (res) != STATEMENT_LIST) + /* Don't try to set location for trees that don't have one, + e.g. STATEMENT_LIST or error_mark_node. */ + if (EXPR_P (res)) SET_EXPR_LOCATION (res, input_location); /* Add the new statement to the block. */