Thread overview
druntime 2.087 regression? (was: Old codebase stops compiling at 2.087)
Nov 17, 2019
James Blachly
Dec 03, 2019
James Blachly
November 17, 2019
TL;DR druntime regression? https://gist.github.com/jblachly/78c5762bbfea65b09e7a1417ad763019

---

Our team has an older codebase that compiled fine up until frontend version 2.087 (builds with 2.086.1).  Now, compiler (DMD2 and LDC2) complains about implicit conversion of shared(AA) to const(shared(AA)).

The codebase is private (could possibly make it public soon) but the error involves an AA inside a shared struct.

```
/home/james/dmd2.087/dmd2/linux/bin64/../../src/druntime/import/object.d(3453,36): Error: cannot implicitly convert expression aa of type shared(GSeqAllele[string]) to const(shared(GSeqAllele)[string])

source/polytyper/gseq.d(231,33): Error: template instance `object.values!(shared(GSeqAllele[string]), shared(GSeqAllele), string)` error instantiating

/home/james/dmd2.087/dmd2/linux/bin64/../../src/druntime/import/object.d(3402,36): Error: cannot implicitly convert expression aa of type shared(GSeqAllele[string]) to const(shared(GSeqAllele)[string])

source/polytyper/gseq.d(280,35): Error: template instance `object.keys!(shared(GSeqAllele[string]), shared(GSeqAllele), string)` error instantiating
```
(line breaks added for clarity)

The two triggering lines both iterate over a built-in AA

gseq.d:231:        foreach (a; this.alleles.values)
gseq.d:208:        foreach (key; this.alleles.keys)

Looking at the changelog for 2.087 ( https://dlang.org/changelog/2.087.0.html ) I do not see any obvious culprits. git blame suggests this is the responsible commit:

https://github.com/dlang/druntime/commit/af86e7db58f4b792e45bdc3ee43c17aadc9d54ab#diff-a68e58fcf0de5aa198fcaceafe4e8cf9L3430-R3454

From this change, it looks like the runtime now cannot handle a shared AA -- is this right? A minimal reproducible example is here: https://gist.github.com/jblachly/78c5762bbfea65b09e7a1417ad763019

Thanks in advance for help
James

PS: Why is this commit ("object: Declare private struct AA and fix aaA function signatures ") not mentioned in the changelog?
November 17, 2019
On 11/17/19 10:45 AM, James Blachly wrote:

> /home/james/dmd2.087/dmd2/linux/bin64/../../src/druntime/import/object.d(3453,36): Error: cannot implicitly convert expression aa of type shared(GSeqAllele[string]) to const(shared(GSeqAllele)[string])

There's a subtle removing of the shared from the entire AA. Is that on purpose?

i.e. I see shared(GSeqAllele[string]) in one, and shared(GSeqAllele)[string] in another.

-Steve
December 03, 2019
On 11/17/19 7:15 PM, Steven Schveighoffer wrote:
> On 11/17/19 10:45 AM, James Blachly wrote:
> 
>> /home/james/dmd2.087/dmd2/linux/bin64/../../src/druntime/import/object.d(3453,36): Error: cannot implicitly convert expression aa of type shared(GSeqAllele[string]) to const(shared(GSeqAllele)[string])
> 
> There's a subtle removing of the shared from the entire AA. Is that on purpose?
> 
> i.e. I see shared(GSeqAllele[string]) in one, and shared(GSeqAllele)[string] in another.
> 
> -Steve

Steve:

Sorry for the delay in replying. That is the runtime removing the shared from the entire AA, not our code. I point out the change that induces this with a link to github.

Should I move this discussion to the main D group? My primary concerns are:

0. Ask if it is intended behavior that the runtime cannot handle a shared AA post 2.086.1?

1. Report this as bug

2. Ask why this commit ("object: Declare private struct AA and fix aaA function signatures ") not mentioned in the changelog for 2.087?

Thanks in advance
December 03, 2019
On 12/3/19 12:15 PM, James Blachly wrote:
> On 11/17/19 7:15 PM, Steven Schveighoffer wrote:
>> On 11/17/19 10:45 AM, James Blachly wrote:
>>
>>> /home/james/dmd2.087/dmd2/linux/bin64/../../src/druntime/import/object.d(3453,36): Error: cannot implicitly convert expression aa of type shared(GSeqAllele[string]) to const(shared(GSeqAllele)[string])
>>
>> There's a subtle removing of the shared from the entire AA. Is that on purpose?
>>
>> i.e. I see shared(GSeqAllele[string]) in one, and shared(GSeqAllele)[string] in another.
>>
> Steve:
> 
> Sorry for the delay in replying. That is the runtime removing the shared from the entire AA, not our code. I point out the change that induces this with a link to github.

I admit, this was a drive-by analysis, and I didn't look at the code at all. Just the error.

> 
> Should I move this discussion to the main D group? My primary concerns are:
> 
> 0. Ask if it is intended behavior that the runtime cannot handle a shared AA post 2.086.1?
> 
> 1. Report this as bug
> 
> 2. Ask why this commit ("object: Declare private struct AA and fix aaA function signatures ") not mentioned in the changelog for 2.087?

0. learn is fine. I'm never one to care about where someone posts.

1. Bugzilla is the correct place to report. Looks like you have a solid case and have done all the hard work. Should be fixable.

2. Not all commits are mentioned in the changelog. But if there is a change that breaks existing code, arguably it should be in there.

-Steve