Exceptions not working on the Seeeduino XIAO even when enabled

I’m trying to enable exceptions on the Seeeduino XIAO. I added the following lines to the platformio.ini file:

build_flags = -fexceptions
build_unflags = -fno-exceptions

I test with this simple code:

#include <Arduino.h>
#include <stdexcept>

void setup() {
	Serial.println("starting exception handling test");
	try {
		throw std::runtime_error("");
	} catch (const std::runtime_error&) {
		Serial.println("caught exception");
	Serial.println("finished exception handling test");

void loop() {}

It compiles fine, but it only prints

starting exception handling test

In other words, it doesn’t executes the catch block or everything after it. It just hangs whenever an exception is thrown.

How to enable exceptions on this board?