https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92634
Bug ID: 92634 Summary: [gcc-8 regression] -fsanitize=undefined erroneous null pointer check Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: amodra at gmail dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org Target Milestone: --- Created attachment 47337 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47337&action=edit testcase -fsanitize=undefined inserts bogus pointer checks on expressions that effectively cast a pointer to a union to a pointer to one of the elements of that union. &p->field does not dereference p, just as &*p and &p[i] do not. This bites in binutils sources (eg. see ldlang.c lang_for_each_input_file), where &p->field is used in preference to (type_of_field *) p, since the cast loses some type checking.