https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101949
Bug ID: 101949 Summary: git miscompiled with -flto -fipa-pta Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: alex_y_xu at yahoo dot ca Target Milestone: --- Created attachment 51313 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51313&action=edit step 2 patch steps to reproduce: 1. download and unpack git-2.33.0 (other versions may also work) 2. apply the attached patch to work around binutils bugs with duplicate function names 3. make CFLAGS="-O2 -flto -fipa-pta" git git-remote-https 4. git clone https://github.com/Hello71/empty-project.git 5. PATH=$PWD:$PATH git -C empty-project fetch 6. objdump --disassemble=iterate_ref_map2 git expected behavior: step 5 succeeds. in step 6, function references %rsi at some point actual behavior: step 5 segfaults. in step 6, function never references %rsi (i.e. returns 0 without populating *oid) additional behavior: it works ok without -flto or without -fipa-pta, thus the non-reduced test case. note that the patch is only required for step 6; step 5 fails even if the patch is not applied.