Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Ticket #408 (closed defect: fixed)

Opened 2 years ago

Last modified 10 months ago

Exception not caught for -inline

Reported by: mwarning Assigned to: ChristianK
Priority: major Milestone:
Component: unspecified Version: hg tip
Keywords: Cc:

Description

Testcase:

"ldc test.d" works "ldc -inline test.d" doesn't work

version (Tango)
    import tango.stdc.stdio: puts;
else
    import std.c.stdio: puts;

class Exception1 : Exception {
    this() { super(null); }
}

class Exception2 : Exception {
    this() { super(null); }
}

void throwit(bool b) {
    if (b)
        throw new Exception1();
    else
        throw new Exception2();
}

void funA() {
    try {
        throwit(false);
    } catch (Exception1 e) {
    }
}

void funB() {
    try {
        funA();
    } catch (Exception2 e) {
    }
}

void main() {
    try {
       funB();
    } catch (Exception e) {
        puts("THIS CAN'T HAPPEN");
    }
}

Change History

06/23/10 19:07:41 changed by mwarning

This was reported by bearophile, the grizzly. ;)

10/24/10 16:52:25 changed by lindquist

The issue is not strictly with inlining. This testcase works with -02 but fails with -O3 regardless of inlining.

10/24/10 18:09:23 changed by lindquist

Actually, ignore that. -O3 enables inlining... However, I've located the problem, which is a major error in how we select what code to jump to in case of an exception. Fix is coming up!

Hint: Use llvm.eh.typeid.for, not constant indices. They change when a function with catch is inlined.

04/30/11 12:43:46 changed by SokoL

  • status changed from new to closed.
  • resolution set to fixed.

It was fixed in https://bitbucket.org/lindquist/ldc/changeset/a645d67e4d19. Thanks to lindquist's hint

Copyright © 2008, LDC Development Team.