Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ldc crashes on excel-d tag v0.3.9 #2808

Closed
atilaneves opened this issue Aug 9, 2018 · 9 comments
Closed

ldc crashes on excel-d tag v0.3.9 #2808

atilaneves opened this issue Aug 9, 2018 · 9 comments

Comments

@atilaneves
Copy link
Contributor

excel-d v0.3.9 cannot be tested with ldc. I tried versions 1.7.0, 1.8.0, 1.9.0, 1.10.0. All of them crash.

$ dub test -q --compiler=ldc2
excel-d WARNING: Not wrapping Overloaded due to it having 2 overloads
source/xlld/wrap/wrap.d(606,24): Deprecation: test.d_funcs.shouldNotBeAProblem is not visible from module wrap
LLVMSymbolizer: error reading file: No such file or directory
#0 0x00007f1e77df064b llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/lib/libLLVM-6.0.so+0x85464b)
#1 0x00007f1e77dee33e llvm::sys::RunSignalHandlers() (/usr/lib/libLLVM-6.0.so+0x85233e)
#2 0x00007f1e77dee5ab (/usr/lib/libLLVM-6.0.so+0x8525ab)
#3 0x00007f1e7757e3b0 __restore_rt (/usr/lib/libpthread.so.0+0x123b0)
#4 0x000055c306ac15cc (ldc2+0x64e5cc)
#5 0x000055c306a82c59 (ldc2+0x60fc59)
#6 0x000055c306a63c4d (ldc2+0x5f0c4d)
#7 0x000055c306a59d84 (ldc2+0x5e6d84)
#8 0x000055c306a713d2 (ldc2+0x5fe3d2)
#9 0x000055c306a71397 (ldc2+0x5fe397)
#10 0x000055c306abdcb1 (ldc2+0x64acb1)
#11 0x000055c306ab50ef (ldc2+0x6420ef)
#12 0x000055c306aa0105 (ldc2+0x62d105)
#13 0x000055c306aa1b74 (ldc2+0x62eb74)
#14 0x000055c306aa1b74 (ldc2+0x62eb74)
#15 0x000055c306a9f954 (ldc2+0x62c954)
#16 0x000055c306a63d47 (ldc2+0x5f0d47)
#17 0x000055c306a56b93 (ldc2+0x5e3b93)
#18 0x000055c306a59d84 (ldc2+0x5e6d84)
#19 0x000055c306a7ab6e (ldc2+0x607b6e)
#20 0x000055c306b2f677 (ldc2+0x6bc677)
#21 0x000055c306b0341a (ldc2+0x69041a)
#22 0x000055c306a0b603 (ldc2+0x598603)
#23 0x000055c306b0120c (ldc2+0x68e20c)
#24 0x000055c306c70760 (ldc2+0x7fd760)
#25 0x000055c306c705e6 (ldc2+0x7fd5e6)
#26 0x00007f1e7709c003 __libc_start_main (/usr/lib/libc.so.6+0x24003)
#27 0x000055c306855b5a (ldc2+0x3e2b5a)
ldc2 failed with exit code -11.

This is on Arch Linux, but the ldc binaries I tried it with came from install.sh. The pacman version also acts the same.

@kinke
Copy link
Member

kinke commented Aug 9, 2018

Please specify the failing LDC command line for simpler reproducibility.

@atilaneves
Copy link
Contributor Author

It doesn't get more reproducible than dub test. Besides, my output is going to depend on the layout of directories on my filesystem and you won't be able to use it. dub test, OTOH, is just going to work, and by "work" I mean ldc will crash.

Anyway:

ldc2 -lib -of../../.dub/packages/unit-threaded-0.7.47/unit-threaded/.dub/build/library-unittest-linux.posix-x86_64-ldc_2080-16C647C4A439759FB13FF81AB6C58390/libunit-threaded.a -d-debug -g -w -oq -od=.dub/obj -d-version=testingExcelD -d-version=testLibraryExcelD -d-version=Have_unit_threaded -I../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/ ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/asserts.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/attrs.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/dub.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/factory.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/from.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/integration.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/io.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/light.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/meta.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/mock.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/options.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/package.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/property.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/randomized/benchmark.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/randomized/gen.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/randomized/package.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/randomized/random.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/reflection.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/runner.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/runtime.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/should.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/testcase.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/testsuite.d ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/unit_threaded/uda.d -vcolumns
Copying target from /home/atila/.dub/packages/unit-threaded-0.7.47/unit-threaded/.dub/build/library-unittest-linux.posix-x86_64-ldc_2080-16C647C4A439759FB13FF81AB6C58390/libunit-threaded.a to /home/atila/.dub/packages/unit-threaded-0.7.47/unit-threaded
Target '/home/atila/kaleidic/excel-d/.dub/build/unittest-unittest-linux.posix-x86_64-ldc_2080-B768E4A4180FF1CC652B1D2C41D51CE3/ut' doesn't exist, need rebuild.
excel-d 0.3.9+commit.1.gab491e8: building configuration "unittest"...
ldc2 -dip1000 -dip25 -of.dub/build/unittest-unittest-linux.posix-x86_64-ldc_2080-B768E4A4180FF1CC652B1D2C41D51CE3/ut -d-debug -g -unittest -w -oq -od=.dub/obj -d-version=testingExcelD -d-version=testLibraryExcelD -d-version=Have_excel_d -d-version=Have_nogc -d-version=Have_unit_threaded -Isource/ -Isource -Itests -I../../.dub/packages/nogc-0.0.1/nogc/source/ -I../../.dub/packages/unit-threaded-0.7.47/unit-threaded/source/ source/xlld/any.d source/xlld/conv/from.d source/xlld/conv/misc.d source/xlld/conv/package.d source/xlld/conv/to.d source/xlld/dummy.d source/xlld/from.d source/xlld/func/framework.d source/xlld/func/xl.d source/xlld/func/xlf.d source/xlld/memorymanager.d source/xlld/package.d source/xlld/sdk/framework.d source/xlld/sdk/xlcall.d source/xlld/sdk/xlcallcpp.d source/xlld/sdk/xll.d source/xlld/static_/package.d source/xlld/test/util.d source/xlld/wrap/package.d source/xlld/wrap/traits.d source/xlld/wrap/worksheet.d source/xlld/wrap/wrap.d tests/test/d_funcs.d tests/test/package.d tests/test/xl_funcs.d tests/ut/conv/from.d tests/ut/conv/misc.d tests/ut/conv/to.d tests/ut/func/xlf.d tests/ut/misc.d tests/ut/wrap/all.d tests/ut/wrap/module_.d tests/ut/wrap/traits.d tests/ut/wrap/wrap.d tests/ut/wrap/wrapped.d tests/ut_main.d ../../.dub/packages/nogc-0.0.1/nogc/.dub/build/library-unittest-linux.posix-x86_64-ldc_2080-F7FC6300F605CBF630757BE90A28995C/libnogc.a ../../.dub/packages/unit-threaded-0.7.47/unit-threaded/.dub/build/library-unittest-linux.posix-x86_64-ldc_2080-16C647C4A439759FB13FF81AB6C58390/libunit-threaded.a -vcolumns

-dip1000 and -dip25 aren't necessary, it crashes without them.

@kinke
Copy link
Member

kinke commented Aug 9, 2018

It doesn't get more reproducible than dub test.

Reproducing with dub is always a PITA. I know that it's nice for you guys reporting issues, but we have to isolate the failing line in order to debug it, and the shorter it is/the less dependencies are needed, the more likely it is to get one of us motivated to have a look at it.

@kinke
Copy link
Member

kinke commented Aug 9, 2018

The problem occurs when trying to create the nested context for extern (Windows) nothrow @trusted xlld.sdk.xlcall.XLOPER12* ut.wrap.module_.__unittest_L562_C7().DoubleArrayToAnyArray(scope xlld.sdk.xlcall.XLOPER12*) (building on Win64); it hits this assertion. The mixin is:

extern(Windows) XLOPER12* DoubleArrayToAnyArray(scope XLOPER12* arg0) nothrow @trusted /* catch Error */  {
    static import test.d_funcs;
    import xlld.wrap.wrap: stringAutoFreeOper;
    import xlld.memorymanager: gTempAllocator;
    import nogc.conv: text;
    import std.experimental.allocator.mallocator: Mallocator;
    alias wrappedFunc = test.d_funcs.DoubleArrayToAnyArray;

    static XLOPER12 errorRet;

    try
        return () @trusted  {return wrapModuleFunctionImpl!wrappedFunc(gTempAllocator, arg0);}();
    catch(Exception e)
        errorRet = stringAutoFreeOper(text("#ERROR calling ", __traits(identifier, wrappedFunc), ": ", e.msg));
    catch(Error e)
        errorRet = stringAutoFreeOper(text("#FATAL ERROR calling ", __traits(identifier, wrappedFunc), ": ", e.msg));

    return &errorRet;
}

@kinke
Copy link
Member

kinke commented Aug 9, 2018

So this function is mixed into the unittest block; it's not static, so it's nested, and supposed to inherit the unittest context (as hidden context pointer argument), which apparently isn't available for unknown reason.

@kinke
Copy link
Member

kinke commented Aug 9, 2018

Minimized:

void foo()
{
    extern(Windows) void DoubleArrayToAnyArray(void* arg0)
    {
        auto dg = () => { auto r = arg0; };
    }
    auto local = 123;
    auto arg = () { return local; }();
    DoubleArrayToAnyArray(null);
}

Note: needs extern(Windows).

@kinke
Copy link
Member

kinke commented Aug 9, 2018

needs extern(Windows)

Nope, needs something other than extern(D).

@kinke
Copy link
Member

kinke commented Aug 9, 2018

Oh, only nested extern(D) functions get the context ptr, see https://github.com/ldc-developers/ldc/blob/master/dmd/func.d#L1595.

@kinke
Copy link
Member

kinke commented Aug 9, 2018

Works for me with #2809 on Win64:

Time taken: 12 ms, 177 ╬╝s, and 1 hnsec
162 test(s) run, 0 failed.

OK!

@kinke kinke closed this as completed Aug 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants