Jump to page: 1 2
Thread overview
[Issue 13861] compiler segfault with nested struct, cannot access frame
Dec 14, 2014
Vlad Levenfeld
Dec 14, 2014
Vlad Levenfeld
Dec 15, 2014
John Colvin
Dec 15, 2014
Vlad Levenfeld
Dec 15, 2014
John Colvin
Dec 15, 2014
Vlad Levenfeld
Dec 15, 2014
Vlad Levenfeld
Dec 15, 2014
John Colvin
Dec 16, 2014
Vlad Levenfeld
Dec 16, 2014
John Colvin
Jan 12, 2015
Kenji Hara
December 14, 2014
https://issues.dlang.org/show_bug.cgi?id=13861

Vlad Levenfeld <vlevenfeld@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vlevenfeld@gmail.com

--
December 14, 2014
https://issues.dlang.org/show_bug.cgi?id=13861

Vlad Levenfeld <vlevenfeld@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code

--
December 15, 2014
https://issues.dlang.org/show_bug.cgi?id=13861

John Colvin <john.loughran.colvin@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.loughran.colvin@gmail.
                   |                            |com

--- Comment #1 from John Colvin <john.loughran.colvin@gmail.com> ---
I don't get the segfault. What version of dmd are you testing on?

--
December 15, 2014
https://issues.dlang.org/show_bug.cgi?id=13861

--- Comment #2 from Vlad Levenfeld <vlevenfeld@gmail.com> ---
git head. The segfault came from the non-reduced version of this code which I wasn't able to use dustmite on (I was only able to make this example by avoiding the segfault, and getting the compiler error instead)

--
December 15, 2014
https://issues.dlang.org/show_bug.cgi?id=13861

--- Comment #3 from John Colvin <john.loughran.colvin@gmail.com> ---
You can dustmite for compiler segfaults by writing an appropriate test script to pass to dustmite: https://github.com/CyberShadow/DustMite/wiki/Detecting-a-segfault-in-dmd-itself

--
December 15, 2014
https://issues.dlang.org/show_bug.cgi?id=13861

--- Comment #4 from Vlad Levenfeld <vlevenfeld@gmail.com> ---
I'm sorry but I can't get the first script to work. It either reduces the codebase to nothing or else I get "Initial Test fails"

--
December 15, 2014
https://issues.dlang.org/show_bug.cgi?id=13861

--- Comment #5 from Vlad Levenfeld <vlevenfeld@gmail.com> ---
The second script is what I tried before, and it just seems to produce an unrelated segfault from definitely incorrect (and unrelated-looking) code.

--
December 15, 2014
https://issues.dlang.org/show_bug.cgi?id=13861

--- Comment #6 from John Colvin <john.loughran.colvin@gmail.com> ---
(In reply to Vlad Levenfeld from comment #5)
> The second script is what I tried before, and it just seems to produce an unrelated segfault from definitely incorrect (and unrelated-looking) code.

Please submit that as a separate bug report. If you're lucky it might fix this one too, you never know.

(In reply to Vlad Levenfeld from comment #4)
> I'm sorry but I can't get the first script to work. It either reduces the codebase to nothing or else I get "Initial Test fails"

Just to clarify, you should have a setup like this:

myFolder
| - projectFolder
    | - the code to reduce
| - dustmiteTest.sh

and you should be able to check your script like this:

$ cd myFolder/projectFolder
$ ../dustmiteTest.sh
$ echo $?
0

Obviously you have to be careful that your script isn't catching false positives (e.g. if you only checked for failure to compile+link, then dustmite will happily remove all your code).

An example of a test script for this bug would be

#!/bin/sh

# arguments to dmd
DMDARGS="file0.d file1.d"

OUTPUT=$(gdb --batch -ex "run $DMDARGS" dmd 2>&1)
echo "$OUTPUT" | fgrep -q 'in FuncDeclaration::hasNestedFrameRefs'
exit $?

--
December 16, 2014
https://issues.dlang.org/show_bug.cgi?id=13861

--- Comment #7 from Vlad Levenfeld <vlevenfeld@gmail.com> ---
Ok, looks like I had a bad directory structure. I got dustmite to work following your suggestion.

Here is a reduced case that segfaults:

struct Foo (alias f)
{
        auto opIndex ()
        {
            return Bar ();
        }

        struct Bar
        {
            Bar opIndex ()
            {
                return Bar ();
            }
            Bar opIndex (size_t)
            {
                return Bar ();
            }
        }
}

void main () {
    Foo!(n => n) A; // SEGFAULT
}

--
December 16, 2014
https://issues.dlang.org/show_bug.cgi?id=13861

--- Comment #8 from John Colvin <john.loughran.colvin@gmail.com> ---
Further reduced:

struct Foo(alias f)
{
    struct Bar
    {
        Bar func()
        {
            return Bar();
        }
    }
}

void main()
{
    Foo!(n => n) a;
}

--
« First   ‹ Prev
1 2