Thread overview
[Issue 15422] [REG2.066] associative array of nested struct - crash on usage
[Issue 15422] associative array of nested struct - crash on usage
Dec 09, 2015
Ivan Kazmenko
Dec 09, 2015
Kenji Hara
Dec 09, 2015
Kenji Hara
Dec 14, 2015
Kenji Hara
December 09, 2015
https://issues.dlang.org/show_bug.cgi?id=15422

Ivan Kazmenko <gassa@mail.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gassa@mail.ru
            Summary|Crash on nested struct      |associative array of nested
                   |                            |struct - crash on usage

--- Comment #1 from Ivan Kazmenko <gassa@mail.ru> ---
Able to reproduce this on win32/win64.

Original D.learn forum thread is mentioned in URL.  An extract from there:

With dmd 2.064.2, the example compiles and runs fine.

With dmd 2.065.0, it does not compile, complaining that there is no opCmp for `Foo`s.

With dmd 2.066.0, and up to the current version dmd 2.069.2, it compiles fine but crashes at runtime.

So I'd say it's a regression somewhere between 2.064 and 2.066.

--
December 09, 2015
https://issues.dlang.org/show_bug.cgi?id=15422

Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code

--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> ---
Introduced in: https://github.com/d-programming-language/dmd/commit/a2f9ddf4eb7d5ffeb4bb157d5dcda9efe2f5b290

The main problem is that, built-in generated hashing operations don't handle hidden context field (foo.tupleof[$-1]) properly.

I discovered that built-in generated equality operations also have equivalent issue.

--
December 09, 2015
https://issues.dlang.org/show_bug.cgi?id=15422

Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
            Summary|associative array of nested |[REG2.066] associative
                   |struct - crash on usage     |array of nested struct -
                   |                            |crash on usage

--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> ---
(In reply to Ivan Kazmenko from comment #1)
> With dmd 2.065.0, it does not compile, complaining that there is no opCmp for `Foo`s.
> 
> With dmd 2.066.0, and up to the current version dmd 2.069.2, it compiles fine but crashes at runtime.
> 
> So I'd say it's a regression somewhere between 2.064 and 2.066.

The guilty commit had been introduced in 2.065, but the actual problem had been hidden until 2.066 was released, by the compiler's "no opCmp" complaint.

PR to fix the issue: https://github.com/D-Programming-Language/dmd/pull/5304

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

--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> ---
New PR: https://github.com/D-Programming-Language/dmd/pull/5308

--
February 01, 2016
https://issues.dlang.org/show_bug.cgi?id=15422

--- Comment #5 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d789012d8630619ee34a680724e4f4ca1e4f091b fix Issue 15422 - associative array of nested struct - crash on usage

If a struct is nested in a class, its `vthis` will be reference to the parent
class, and struct default equality and hashing considers the parent class
equality and hashing.
Otherwise, the `vthis` will be typed as void*, and pointer equality and hashing
is merely used.

https://github.com/D-Programming-Language/dmd/commit/92b3fead80829a3dd4e8618dc5533bd62b1f455c Merge pull request #5391 from 9rnsr/fix15422

[REG2.066] Issue 15422 - associative array of nested struct - crash on usage

--
February 01, 2016
https://issues.dlang.org/show_bug.cgi?id=15422

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--