Fix potentially undefined behaviour in the linker when parsing input statements.
[deliverable/binutils-gdb.git] / ld / ldlang.h
index 8cc5cf7f900670de68e76a784bc8011a8027bce2..3e3e6a028940b4f8b6d937773bfa217b0e98787b 100644 (file)
@@ -574,7 +574,7 @@ extern asection *section_for_dot
 
 #define LANG_FOR_EACH_INPUT_STATEMENT(statement)                       \
   lang_input_statement_type *statement;                                        \
-  for (statement = &file_chain.head->input_statement;                  \
+  for (statement = file_chain.head == NULL ? NULL : &file_chain.head->input_statement; \
        statement != NULL;                                              \
        statement = statement->next)
 
This page took 0.022891 seconds and 4 git commands to generate.