Bus error when Catch2 tries catching an exception when using Clang 19

オープン
#2,913 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
cpp
領域
testing-qa

調査の方向性

Issue にある最小限の C++ 再現コードから始め、macOS 15 上で Catch2 v3.7.1 と Clang 19.1 を使ってビルドし、Catch2 が送出された例外を処理したときに bus error が発生することを確認します。通常の例外処理と REQUIRE_THROWS を比較します。Catch2 がクラッシュせず、妥当な出力を生成し、この動作を対象とする対応テストがある状態を完了とします。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug
When Catch2 catches an exception thrown by test code in Clang 19.1 (at least the version I have installed using homebrew on my Mac), it results in a Bus error: 10. This occurs regardless of whether or not the exception is raised inside a REQUIRE macro, so long as the exception is caught by Catch2. (If I set up a try block to catch the exception myself before any Catch2 code sees it, it doesn't seem to cause a problem.)

Expected behavior
Catch2 should catch the exception and produce some kind of reasonable output. If in a REQUIRE_THROWS macro where an appropriate exception is raised, the test should pass.

Reproduction steps
This test file was enough to trigger the problem for me:

#define CATCH_CONFIG_MAIN
#include "catch2/catch_test_macros.hpp"


TEST_CASE( "blah", "blah" ) {

  SECTION( "blah" ) {
    throw(std::runtime_error("Hi"));
  }

}

I typically get output like this:

Randomness seeded to: 638767569
Bus error: 10

Platform information:

  • OS: macOS 15
  • Compiler+version: Clang 19.1 (from homebrew)
  • Catch version: v3.7.1 (compiled from source with same version of Clang)
主要言語
C++
スター
21.6k
フォーク
3.4k
平均マージ
3日 12時間
マージ済み PR(30日)
5

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

catchorg/Catch2 のほかの issue

catchorg/Catch2 の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。