Bug 112823 - [11 only] -Wincompatible-pointer-types errors in libiberty/simple-object-mach-o.c (missing backport for gcc-11)
Summary: [11 only] -Wincompatible-pointer-types errors in libiberty/simple-object-mach...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 11.4.0
: P3 normal
Target Milestone: 11.5
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2023-12-02 04:19 UTC by Sam James
Modified: 2023-12-02 20:16 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James 2023-12-02 04:19:03 UTC
```
make[3]: Leaving directory '/var/tmp/portage/sys-devel/gcc-11.4.1_p20231123/work/build/build-x86_64-pc-linux-gnu/libiberty'
make[3]: Entering directory '/var/tmp/portage/sys-devel/gcc-11.4.1_p20231123/work/build/build-x86_64-pc-linux-gnu/libiberty'
x86_64-pc-linux-gnu-gcc -c -DHAVE_CONFIG_H -march=native -pipe -Wa,-O2 -Wa,-mtune=znver2 -fcf-protection=none -fdiagnostics-color=always -fdiagnostics-urls=never -ggdb3 -g -O3  -I. -I/var/tmp/portage/sys-devel/gcc-11.4.1_p20231123/work/gcc-11-20231123/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic  -D_GNU_SOURCE -fcf-protection /var/tmp/portage/sys-devel/gcc-11.4.1_p20231123/work/gcc-11-20231123/libiberty/simple-object-mach-o.c -o simple-object-mach-o.o
/var/tmp/portage/sys-devel/gcc-11.4.1_p20231123/work/gcc-11-20231123/libiberty/simple-object-mach-o.c: In function ‘simple_object_mach_o_write_segment’:
/var/tmp/portage/sys-devel/gcc-11.4.1_p20231123/work/gcc-11-20231123/libiberty/simple-object-mach-o.c:1231:17: error: passing argument 1 of ‘set_32’ from incompatible pointer type [-Wincompatible-pointer-types]
 1231 |         set_32 (&index[i], index[i]);
      |                 ^~~~~~~~~
      |                 |
      |                 unsigned int *
/var/tmp/portage/sys-devel/gcc-11.4.1_p20231123/work/gcc-11-20231123/libiberty/simple-object-mach-o.c:1231:17: note: expected ‘unsigned char *’ but argument is of type ‘unsigned int *’
make[3]: *** [Makefile:1309: simple-object-mach-o.o] Error 1
make[3]: Leaving directory '/var/tmp/portage/sys-devel/gcc-11.4.1_p20231123/work/build/build-x86_64-pc-linux-gnu/libiberty'
make[3]: *** Waiting for unfinished jobs....
make[3]: Entering directory '/var/tmp/portage/sys-devel/gcc-11.4.1_p20231123/work/build/build-x86_64-pc-linux-gnu/libiberty'
```

r12-3005-g220c410162ebec was backported to releases/gcc-11 but the fixup commit r12-3092-g38757aa88735ab wasn't yet backported, so we just need to pull that in.
Comment 1 Sam James 2023-12-02 04:19:42 UTC
At some point, I think we should consider using formal Fixes: git trailers or something to help find missed backports, but that's another story.
Comment 2 Sam James 2023-12-02 20:16:37 UTC
https://inbox.sourceware.org/gcc-patches/87plzp5ac8.fsf@gentoo.org/T/#m8edd6947776f6d591121340d391f824d897605d0

It got merged w/o the PR #:

commit 02cd761eb1198df50453b2e39653f48053609ffc (HEAD -> releases/gcc-11, origin/releases/gcc-11)
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Mon Aug 23 17:34:43 2021 +0100

    libiberty, Darwin: Fix a build warning.

    r12-3005-g220c410162ebece4f missed a cast for the set_32 call.
    Fixed thus.

    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

    libiberty/ChangeLog:

            * simple-object-mach-o.c (simple_object_mach_o_write_segment):
            Cast the first argument to set_32 as needed.

    (cherry picked from commit 38757aa88735ab2e511bc428e2407a5a5e9fa0be)