From 10c0005660cda5ff317da5834e919ce99e517c0e Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 12 Apr 2022 21:50:09 +0930 Subject: ubsan: member access within null pointer of union Add some nonsense to cover "undefined behaviour". * ldlang.c (section_for_dot): Avoid UB. --- ld/ldlang.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ld/ldlang.c') diff --git a/ld/ldlang.c b/ld/ldlang.c index 1c8d229..f10557a 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 -- cgit v1.1