From: Alan Modra Date: Tue, 12 Apr 2022 12:20:09 +0000 (+0930) Subject: ubsan: member access within null pointer of union X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=10c0005660cda5ff317da5834e919ce99e517c0e;p=binutils-gdb.git ubsan: member access within null pointer of union Add some nonsense to cover "undefined behaviour". * ldlang.c (section_for_dot): Avoid UB. --- diff --git a/ld/ldlang.c b/ld/ldlang.c index 1c8d229326c..f10557af842 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -6726,7 +6726,7 @@ section_for_dot (void) if (stmt->header.type == lang_output_section_statement_enum) break; - os = &stmt->output_section_statement; + os = stmt ? &stmt->output_section_statement : NULL; while (os != NULL && !os->after_end && (os->bfd_section == NULL