Issue 17088 - Access Violation on membership test with shared AA
Summary: Access Violation on membership test with shared AA
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: x86_64 Windows
: P2 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-14 03:37 UTC by m.bierlee
Modified: 2024-12-07 13:37 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description m.bierlee 2017-01-14 03:37:04 UTC
Consider the following code:
void main() {
	shared int[int] ints = [6: 8];
	auto bla = (6 in ints);
}

The following console output is returned when running this code in release mode:
$ dub run --build=release
Performing "release" build using dmd for x86.
assocbug ~master: building configuration "application"...
Linking...
Running .\assocbug.exe

object.Error@(0): Access Violation
----------------
0x0040249A
0x004023B3
0x004022B4
0x004020A8
0x76C962C4 in BaseThreadInitThunk
0x77520FD9 in RtlSubscribeWnfStateChangeNotification
0x77520FA4 in RtlSubscribeWnfStateChangeNotification
Program exited with code 1

This seems to only happen in release builds and not debug builds. Furthermore as far I could test, it seems to only happen on Windows.

Details:
DMD32 D Compiler v2.072.2
Windows 10 x86_64
DUB version 1.1.2
Comment 1 savarga1 2017-02-11 19:08:37 UTC
I was able to replicate this bug on Arch Linux (64bit), dmd v2.073.0.
I get a segfault whenever I run this code:

void main() {
	shared int[int] ints = [6: 8];
	auto bla = (6 in ints);
}

However, when I compile and run it with ldc 1:1.0.0-1 I get 0 segfaults
and it runs correctly.


When I separated the declaration and the assignment like below
it worked in both compilers. 

void main() {
	shared int[int] ints;
        ints[6] = 8;
	auto bla = (6 in ints);
}
Comment 2 m.bierlee 2017-08-13 16:59:10 UTC
In DMD 2.075.0 (DMD32 D Compiler v2.075.0) this issue also seems to happen in debug mode, with the following stack trace:

object.Error@(0): Access Violation
----------------
0x004028CA in _d_assocarrayliteralTX
0x0040257F in D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv
0x00402543 in void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()
0x00402444 in _d_run_main
0x0040222C in main at D:\Temp\assocbug\source\app.d(7)
0x0041F131 in mainCRTStartup
0x76208744 in BaseThreadInitThunk
0x7755582D in RtlGetAppContainerNamedObjectPath
0x775557FD in RtlGetAppContainerNamedObjectPath
Program exited with code 1

Using the code from the original post
Comment 3 dlangBugzillaToGithub 2024-12-07 13:37:11 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/17341

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB