Skip to content

Windows: -fsanitize=address doesn't work with exceptions #3760

@mikey-b

Description

@mikey-b

Hi all,

On Windows 10 64bit, LDC2 1.27.0-beta1. I am having issues with throwing exceptions in constructors. Address sanatiser is able to catch the issue as an access violation. Here is example code to trigger this issue:

import std.stdio;

class example: Exception {
	this(string msg, string file = __FILE__, size_t line = __LINE__) {
		super(msg, file, line);
	}
}

class test {
	this() {		
		throw new example("this is a test");
	}
}

void main() {
	try {
		auto t = new test();
	} catch (example e) {
		writeln(e.msg);
	}
}

Compiled with:
ldc2.exe -g -fsanitize='address' .\test.d -of='test.exe'

Access Violation is on "writeln(e.msg)" line.

Kind regards,
Mike Brown

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions