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

Aperta
#2,913 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
cpp
Ambito
testing-qa

Direzione di ricerca

Inizia con la riproduzione minima in C++ nell’issue, compilata con Catch2 v3.7.1 e Clang 19.1 su macOS 15, e conferma l’errore bus quando Catch2 gestisce l’eccezione lanciata. Confronta la gestione ordinaria delle eccezioni con REQUIRE_THROWS; il lavoro è completato quando Catch2 non va più in crash e produce un output ragionevole, con un test corrispondente che copra il comportamento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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)
Lingua principale
C++
Stelle
21.6k
Fork
3.4k
Merge medio
3g 12h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di catchorg/Catch2

Tutte le issue di catchorg/Catch2

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.