-
-
Notifications
You must be signed in to change notification settings - Fork 262
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
Merge 2.078.1 front-end and stdlibs #2486
Conversation
The ICE when compiling LDC on Windows is bad; it's a front-end bug for MSVC targets which has been (wrongly) worked around only since 2.078.0 itself AFAICT, i.e., all current host compilers on Windows will crash. If we're lucky, an older version (ltsmaster) doesn't feature that particular MSVC-specific check. The bug is here: Lines 664 to 674 in 13d5cd6
FuncDeclaration.parent is a TemplateMixin (dmd.transitivevisitor.ParseVisitMethods mixed into dmd.visitor.SemanticTimeTransitiveVisitor ) while the code assumes it's a valid ClassDeclaration (and since 2.078.0 wrongly aborts the check if it isn't). [DMD host compilers < 2.078.0 crash too with -m32mscoff and -m64 ; -m32 doesn't perform that check.]
=> DMD issue #18200 |
The crash happens since dmd 2.071, see https://issues.dlang.org/show_bug.cgi?id=18093. If my tests were correct, the workaround to build with pre dmd 2.078 versions could be to add extern (C++) to the overloads in the template mixins. |
Ah thanks, so it's known already. LDC 1.0.0 (2.070) manages to compile the new front-end, but the LDC then immediately fails when compiling Phobos ( Lines 4528 to 4543 in 13d5cd6
|
Adding extern(C++) worked in the reduced test case in the bug report (no idea why), but doesn't help in dmd.
|
Thanks, I'll give that a shot too. I'm currently stumbling from one problem to the next; DMD 2.078.0 doesn't link out of the box in an MSVC 2017 environment, I thought that was one of the news? |
Unfortunately a corresponding installer PR didn't make it into the release, so you have to nuke most settings in sc.ini. For auto detection the Environment64 section should look this:
|
The LINKCMD settings is propably the only harmful setting in the zip file version. You could filter that out with |
Thanks; tweaking the ini locally worked, but I forgot about the cmdline parsing issue ( Making the previously new virtual functions private works indeed, i.e., gets rid of the segfault, but the |
The issue seems to boil down to vtable layout. Excerpt of stack trace with debug build of LDC:
|
Oh this appears to be fixed by fixing |
…tor) Apparently crucial for correct MSVC++ vtable layout.
Now all done in the front-end, no need for us to handle it manually anymore. This also fixes tests/semantic/dcompute.d.
Using the existing pragma(LDC_global_crt_{c,d}tor [, priority]) infrastructure.
By enforcing a -singleobj build in that case, treating the special __main module as a regular additional source module. This fixes the new test fail_compilation/test11006 although this check most likely wasn't intended. It previously errored out with: Error: Output file '...' for module `__main` collides with previous module `test11006`. See the -oq option
Green on Linux. :) |
For array comparisons (new) and the _adReverse family.
Can anyone on OSX check the issue with shared libs? |
I have had a number of things in the pipeline for a long time so I want to spend my time on that first in the next two weeks or so, sorry. |
Tried this pull out on Android/ARM and ran the stdlib tests, have 6 phobos modules that segfault when running the tests, all related to optimization codegen as they only fail at First time I've had issues on Android/ARM since late last summer, #2024, will investigate further. |
Conflicts: driver/main.cpp gen/cl_helpers.h gen/declarations.cpp runtime/druntime tests/d2/dmd-testsuite
@klickverbot: Can you be bothered? ;) - By the looks of it, each shared unittest fails, so possibly even a hello world due to some fundamental issue during druntime initialization. So building this branch, a hello world with |
[This somehow doesn't suffer from the new dmd-testsuite timeouts for CircleCI Linux and the master branch. What seems to be hanging there is 32-bit |
@kinke, do you have shell access rights for the Travis Mac CI? That could be a way for you to get into a Mac. |
DMD actually expects a relative one. It's required now on Windows with new test runnable/test13742.sh due to the limited string support of rt.config for runtime command-line options like `--DRT-covopt=dstpath:C:\dir` (colon in C:\ treated as separator).
I was a bit reluctant at first but got SSH set up with Circle, works like a charm. So the OSX shared lib issue should be fixed. 2.078.1 came with a new test, // Only emit coverage increment for locations in the source of the current module
// (for example, 'inlined' methods from other source files should be skipped).
if (!global.params.cov || !loc.linnum || !loc.filename || !m->d_cover_data ||
strcmp(m->srcfile->name->toChars(), loc.filename) != 0) {
return;
} So this means that a template which isn't emitted in its declaring module won't have any coverage, although it may be instantiated and emitted in other modules, and seems like the obvious reason for the test failure. DMD apparently now decorates the coverage data symbol names with the module ID and makes them global, so we should probably do the same. |
This is what DMD does and crucial for `ldmd2 -od=objects foo.d` with relative -od path (and no -of). The object file path will be `objects/foo.o[bj]`. As it's relative, LDC used to prepend the objects dir (again) in LDMD mode, resulting in the inferred executable file name `objects/objects/foo[.exe]`. So while this is a breaking change, it fixes DMD compatibility of LDMD and makes a lot of sense for 'pure' LDC too IMO (use the first object's file name, replace the extension and save it in the working dir, not in the directory containing the first object file). This fixes the dmd-testsuite regressions with relative RESULTS_DIR and a few long-standing non-fatal dmd-testsuite errors (failing file removals).
Conflicts: tests/d2/CMakeLists.txt tests/d2/dmd-testsuite
@joakim-noah: Any insights? I'm about to merge this to restore Circle builds. |
Been looking into ARM, believe it's a Phobos regression related to some std.regex refactoring Dmitry did recently. I will submit a pull once I track it down, likely upstream, please go ahead and merge this pull whenever you're ready. |
Spent several hours in a debugger trying to track down the ARM regression in @DmitryOlshansky, the main big change in |
@joakim-noah Do you have a dustmite session running in the meanwhile to reduce the problem case? |
Puh, that code is no easy read, I quickly gave up. ;)
What comes to mind is that we emit classes as packed IR structs, meaning that there's no trailing padding, conforming to the class-instance-size trait AFAICT. I guess that's fine though (i.e., the GC allocator taking care of alignment), and there shouldn't be any arrays of consecutive object payloads (as opposed to object references). |
Well looking at the PR is much more pleasant, and I strongly suspect the manual memory management via override Matcher!Char dup(Matcher!Char engine, in Char[] input) const @trusted
{
immutable size = EngineType!Char.initialMemory(engine.pattern) + classSize;
auto memory = enforce(malloc(size), "malloc failed")[0 .. size];
scope(failure) free(memory.ptr);
auto copy = construct(engine.pattern, input, memory);
GC.addRange(memory.ptr, classSize);
engine.dupTo(copy, memory[classSize .. size]); // <-- memory.ptr + classSize may likely be unaligned
assert(copy.refCount == 1);
return copy;
} I didn't dig deep, but it looks like a class payload and some other thing are stored consecutively in memory, exactly without padding bytes inbetween, so that the 2nd payload is likely to be misaligned. [Also involved: @joakim-noah: You might want to give |
@JohanEngelen, never tried dustmite, will it narrow down Phobos regressions? @kinke, anyway, dustmite doesn't matter now, because you got it. Adding that padding fixes the problems across all six modules, which were all related to this Go ahead and commit your |
Sure! https://github.com/CyberShadow/DustMite/wiki#minimizing-the-standard-library |
Thx for verifying, Joakim. I pushed the hotfix directly to master; the upstream PR is dlang/phobos#6185. |
Maybe time to release a 1.8 beta now? Btw, a dmd bugfix update was just released. |
No description provided.