[Issue 10985] Compiler doesn't attempt to inline non-templated functions from libraries (even having the full source)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 15 19:33:32 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10985



--- Comment #6 from Kenji Hara <k.hara.pg at gmail.com> 2013-09-15 19:33:24 PDT ---
The root cause is in mars.c around line 1580.

https://github.com/D-Programming-Language/dmd/blob/a5086fa49c5cd236297584c07e03be8e52208158/src/mars.c#L1579

    if (global.params.useInline)
    {
        /* The problem with useArrayBounds and useAssert is that the
         * module being linked to may not have generated them, so if
         * we inline functions from those modules, the symbols for them will
         * not be found at link time.
         * We must do this BEFORE generating the .deps file!
         */
        if (!global.params.useArrayBounds && !global.params.useAssert)
        {
            // Do pass 3 semantic analysis on all imported modules,
            // since otherwise functions in them cannot be inlined
            for (size_t i = 0; i < Module::amodules.dim; i++)
            {
                m = Module::amodules[i];
                if (global.params.verbose)
                    printf("semantic3 %s\n", m->toChars());
                m->semantic3();
            }
            if (global.errors)
                fatal();
        }
    }

To turn off both useArrayBounds and useAssert flags, specifying `-release
-noboundscheck` in command line is necessary.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list