Skip to content

gcc (g++): ld: Assertion failed: (resultIndex < sectData.atoms.size()) (Xcode 15) #145991

@osalbahr

Description

@osalbahr

brew gist-logs <formula> link OR brew config AND brew doctor output

$ brew config
HOMEBREW_VERSION: 4.1.13-4-gf1d345a
ORIGIN: https://github.com/Homebrew/brew
HEAD: f1d345a60e2c02f7e5c1b7930601b1921432cfb6
Last commit: 12 hours ago
Core tap origin: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 05f8a448ff23501ac834c6d9ce5802ecb23bf520
Core tap last commit: 13 minutes ago
Core tap branch: master
Core tap JSON: 26 Sep 00:21 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 4
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: quad-core 64-bit kabylake
Clang: 15.0.0 build 1500
Git: 2.42.0 => /usr/local/bin/git
Curl: 8.1.2 => /usr/bin/curl
macOS: 13.6-x86_64
CLT: 15.0.0.0.1.1694021235
Xcode: N/A
$ brew doctor
Your system is ready to brew.

Verification

What were you trying to do (and why)?

Compile c++ program for https://open.kattis.com/problems/mancala.

What happened (include all command output)?

$ g++-13 -std=gnu++17 minimal.cpp -o minimal
0  0x10d7cef43  __assert_rtn + 64
1  0x10d6d0f43  ld::AtomPlacement::findAtom(unsigned char, unsigned long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1411
2  0x10d6ed431  ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) const + 19745
3  0x10d6fdb71  ld::InputFiles::parseAllFiles(void (ld::AtomFile const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo const&) const + 657
4  0x7ff80075e066  _dispatch_client_callout2 + 8
5  0x7ff80077118f  _dispatch_apply_invoke_and_wait + 213
6  0x7ff800770692  _dispatch_apply_with_attr_f + 1207
7  0x7ff800770847  dispatch_apply + 45
8  0x10d796972  ld::AtomFileConsolidator::parseFiles(bool) + 370
9  0x10d71dd67  main + 12263
ld: Assertion failed: (resultIndex < sectData.atoms.size()), function findAtom, file Relocations.cpp, line 1336.
collect2: error: ld returned 1 exit status
$ cat minimal.cpp                                          
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	vector<int> v;
	cout << v.size() << endl;
}

What did you expect to happen?

$ g++ -std=gnu++17 minimal.cpp -o minimal
$ ./minimal 
0

More info:

$ g++-13 --version
g++-13 (Homebrew GCC 13.2.0) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ which g++-13
/usr/local/bin/g++-13
$ which g++
/usr/bin/g++

Afaik, this issue started after upgrading Xcode command line tools. I did some digging, and there's an Apple forum from 6 days ago:
https://developer.apple.com/forums/thread/737707

(also a Discussion https://discussions.apple.com/thread/255137447)

I am not sure if this is just a bug in Xcode, so I am opening this issue to track it.

See also:

Step-by-step reproduction instructions (by running brew commands)

g++-13 -std=gnu++17 minimal.cpp -o minimal

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugReproducible Homebrew/homebrew-core bugoutdatedPR was locked due to ageupstream issueAn upstream issue report is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions