]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran: Fix ICE-on-invalid in trans_code.
authorSandra Loosemore <sloosemore@baylibre.com>
Sat, 4 Jul 2026 13:58:42 +0000 (13:58 +0000)
committerSandra Loosemore <sloosemore@baylibre.com>
Sun, 5 Jul 2026 14:16:16 +0000 (14:16 +0000)
gcc/fortran/ChangeLog
* trans.cc (trans_code): Do not try to set location on non-expr
tree expressions, e.g. error_mark_node.

gcc/fortran/trans.cc

index b2ea499bbbe67de0203ac2f51d8ad671b6a68813..51252561b2e4dc807bb4ccf4d00633ee4bc000a2 100644 (file)
@@ -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.  */