https://issues.dlang.org/show_bug.cgi?id=10966
yebblies <yebbl...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yebbl...@gmail.com Version|D2 |D1 & D2 Assignee|nob...@puremagic.com |bugzi...@digitalmars.com Summary|Leaked destruction in |Optimizer generates wrong |static array postblit |code with try-catch Severity|critical |blocker --- Comment #3 from yebblies <yebbl...@gmail.com> --- Reduces to: void bug10966(void* p) { void* pstart = p; try { p = null; throw new Exception("dummy"); } catch (Throwable o) { assert(p != pstart); } } void test10966() { int s; int[4] ss; bug10966(ss.ptr); } The glue layer turns this into basic blocks, but with not connection between the block containing the throw and the catch block. The backend assumes that it is not possible for the assert to be run after p has been reassigned, so it propagates the old value of p. This is very similar to issue 12503 I can easily fix this exact case by adding a relationship between the basic blocks, but replacing the throw with a function that throws will cause the same problem. Maybe simply adding the dependency for all basic blocks inside the try will do the trick, but it seems like something that should be better supported in the backend. dmc does the same thing with the equivalent code - it all looks horribly broken. Walter, is there a mechanism for this in the backend or is it completely unsupported? --