public inbox for gdb-testers@sourceware.org help / color / mirror / Atom feed
From: sergiodj+buildbot@sergiodj.net To: gdb-testers@sourceware.org Subject: [binutils-gdb] Fix compile time warnings building the binutils with clang. Date: Thu, 01 Feb 2018 13:38:00 -0000 [thread overview] Message-ID: <e99955cd8eca9ac8eff828e8c7b676955fd46e04@gdb-build> (raw) *** TEST RESULTS FOR COMMIT e99955cd8eca9ac8eff828e8c7b676955fd46e04 *** Author: Simon Marchi <simon.marchi@ericsson.com> Branch: master Commit: e99955cd8eca9ac8eff828e8c7b676955fd46e04 Fix compile time warnings building the binutils with clang. bfdI would like to fix instances of the following warning, when building with clang with no special CFLAGS other than -g3 -O0. /home/emaisin/src/binutils-gdb/bfd/elflink.c:5425:45: error: performing pointer arithmetic on a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic] return (struct elf_link_hash_entry *) 0 - 1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ Replacing those with "(struct elf_link_hash_entry *) -1" gets rid of the warning. I wanted to check that it didn't change the resulting code, so I tried to build this: $ cat test.c int *before() { return (int *) 0 - 1; } int *after() { return (int *) - 1; } $ gcc -c test.c -g $ objdump -d test.o test.o: file format elf64-x86-64 Disassembly of section .text: 0000000000000000 <before>: 0: 55 push %rbp 1: 48 89 e5 mov %rsp,%rbp 4: 48 c7 c0 fc ff ff ff mov $0xfffffffffffffffc,%rax b: 5d pop %rbp c: c3 retq 000000000000000d <after>: d: 55 push %rbp e: 48 89 e5 mov %rsp,%rbp 11: 48 c7 c0 ff ff ff ff mov $0xffffffffffffffff,%rax 18: 5d pop %rbp 19: c3 retq This shows that the previous code doesn't actually return -1 as the function documentation says, but the new one does, so it's kind of a bugfix. bfd * elf64-ppc.c (ppc64_elf_archive_symbol_lookup): Avoid pointer arithmetic on NULL pointer. * elflink.c (_bfd_elf_archive_symbol_lookup, elf_link_add_archive_symbols): Likewise. ld * ldexp.c (fold_name, exp_fold_tree_1): Avoid pointer arithmetic on NULL pointer.
next reply other threads:[~2018-02-01 13:38 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-02-01 13:38 sergiodj+buildbot [this message] 2018-02-01 13:38 ` Failures on Debian-s390x-m64, branch master sergiodj+buildbot 2018-02-01 13:41 ` Failures on Fedora-i686, " sergiodj+buildbot 2018-02-01 13:43 ` Failures on Fedora-x86_64-native-gdbserver-m32, " sergiodj+buildbot 2018-02-01 13:47 ` Failures on Fedora-x86_64-m64, " sergiodj+buildbot 2018-02-01 13:53 ` Failures on Debian-s390x-native-extended-gdbserver-m64, " sergiodj+buildbot 2018-02-01 13:58 ` Failures on Ubuntu-AArch32-native-extended-gdbserver-m32, " sergiodj+buildbot 2018-02-01 14:04 ` Failures on Ubuntu-AArch64-native-gdbserver-m64, " sergiodj+buildbot 2018-02-01 14:05 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " sergiodj+buildbot 2018-02-01 14:06 ` Failures on Debian-s390x-native-gdbserver-m64, " sergiodj+buildbot 2018-02-01 14:17 ` Failures on Fedora-x86_64-m32, " sergiodj+buildbot 2018-02-01 14:20 ` Failures on Fedora-x86_64-native-gdbserver-m64, " sergiodj+buildbot 2018-02-01 14:39 ` Failures on Ubuntu-AArch32-native-gdbserver-m32, " sergiodj+buildbot 2018-02-01 14:39 ` Failures on Ubuntu-AArch64-m64, " sergiodj+buildbot
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=e99955cd8eca9ac8eff828e8c7b676955fd46e04@gdb-build \ --to=sergiodj+buildbot@sergiodj.net \ --cc=gdb-testers@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).