www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - LDC crashes with SIMD intrinsics.

reply NaN <divide by.zero> writes:
Latest version of LDC, and AuburnSounds intelli/intrinsics 
library..

This causes the compiler to crash...

float foo(float val)
{
     return _mm_set1_ps(val)[0];
}

Whereas this is OK...

float foo(float val)
{
     __m128 tmp = _mm_set1_ps(val);
     return tmp[0];
}

Seems indexing directly on the return of any intrinsic function 
causes the crash, at least everything i tried had the same result.

==>

Performing "release" build using ldc2 for x86_64.
sonijit ~master: building configuration "application"...
Wrote crash dump file 
"C:\Users\Chris\AppData\Local\Temp\ldc2.exe-62c685.dmp"
0x000000013F7486BA (0x0000000803D404B1 0x0000000000A88730 
0x00001D7BD591CB54 0x0000000140B0CB48)
0x000000013F75F06F (0x0000000000000000 0x000000013F769B99 
0x000000001DFEF400 0x00000000023A1AD0)
0x000000013F755346 (0x000000014119F882 0x000000001E0265A8 
0x000000001E0265A8 0x000000000263A560)
0x000000013F7726CA (0x000000014119F882 0x000000013F6CF6E5 
0x00001D7BD591C4C4 0x000000013F79250F)
0x000000013F76D955 (0x00000000132E7480 0x00001D7BD591C5C4 
0x000000001DDA5348 0x000000001E0265A8)
0x000000013F76D822 (0x0000000000000000 0x0000000140B06B09 
0x00001D7BD591C574 0x0000000000000000)
0x000000013F7320FC (0x00000000023ABEB0 0x000000013F71F3A9 
0x00001D7BD591C034 0x00000000023ABEB0)
0x000000013F6C8CE9 (0x0000000076EE5430 0x0000000000000000 
0x0000000076EE5430 0x0000000000000000)
0x000000013F6F224D (0x000000001ECF41A0 0x000000013F6B3107 
0x000000001ECEE120 0x000000001ECEE900)
0x000000013F71B5C5 (0x0000000000000000 0x0000000000000000 
0x000000001EADB970 0x0000000141139FF0)
0x000000013F6BC046 (0x00000000411A2000 0x0000000000A88538 
0x0000000076EE5430 0x0000000000000000)
0x000000013F5A87AA (0x000000000000000F 0xFFFFFFFF00000000 
0xFFFFFFFFFFFFFFFF 0xFFFFFFFFFFFFFFFF)
0x000000013F6BBC7B (0x0000000000000001 0x000000000099F720 
0x000000000099F8F8 0x0000000000000000)
0x000000013F4F1021 (0x0000000000000059 0x0000000000000002 
0x0000000000AC4610 0x0000000000A80000)
0x0000000140FB0ACD (0x0000000000000055 0x0000000076BD35B5 
0x00001D7B00000055 0x0000000141121428)
0x0000000140FB096E (0x0000000000000000 0x0000000000000000 
0x0000000000000000 0x01D4B8EDC44476DF)
0x00000001410C8824 (0x0000000000000000 0x0000000000000000 
0x0000000000000000 0x0000000000000000)
0x0000000076BC652D (0x0000000000000000 0x0000000000000000 
0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 
0xD bytes(s)
0x0000000076DFC541 (0x0000000000000000 0x0000000000000000 
0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 
0x21 bytes(s)
ldc2 failed with exit code -1073741819.
The terminal process terminated with exit code: 2
Jan 30 2019
parent reply Guillaume Piolat <first.last gmail.com> writes:
On Wednesday, 30 January 2019 at 23:02:16 UTC, NaN wrote:
 Latest version of LDC, and AuburnSounds intelli/intrinsics 
 library..

 This causes the compiler to crash...

 float foo(float val)
 {
     return _mm_set1_ps(val)[0];
 }

 Whereas this is OK...

 float foo(float val)
 {
     __m128 tmp = _mm_set1_ps(val);
     return tmp[0];
 }

 Seems indexing directly on the return of any intrinsic function 
 causes the crash, at least everything i tried had the same 
 result.
Good catch, reproduced without intel-intrinsics: https://d.godbolt.org/z/gHTtpA This crashes all LDC versions. Next time could you please report in intel-intrinsics or LDC bugtracker? Forum posts come and go, but issues stay.
Jan 30 2019
next sibling parent Guillaume Piolat <first.last gmail.com> writes:
On Wednesday, 30 January 2019 at 23:47:21 UTC, Guillaume Piolat 
wrote:
 On Wednesday, 30 January 2019 at 23:02:16 UTC, NaN wrote:
 Latest version of LDC, and AuburnSounds intelli/intrinsics 
 library..

 This causes the compiler to crash...
Reported https://github.com/ldc-developers/ldc/issues/2988
Jan 30 2019
prev sibling parent NaN <divide by.zero> writes:
On Wednesday, 30 January 2019 at 23:47:21 UTC, Guillaume Piolat 
wrote:
 On Wednesday, 30 January 2019 at 23:02:16 UTC, NaN wrote:
 Latest version of LDC, and AuburnSounds intelli/intrinsics 
 library..

 This causes the compiler to crash...

 float foo(float val)
 {
     return _mm_set1_ps(val)[0];
 }

 Whereas this is OK...

 float foo(float val)
 {
     __m128 tmp = _mm_set1_ps(val);
     return tmp[0];
 }

 Seems indexing directly on the return of any intrinsic 
 function causes the crash, at least everything i tried had the 
 same result.
Good catch, reproduced without intel-intrinsics: https://d.godbolt.org/z/gHTtpA This crashes all LDC versions. Next time could you please report in intel-intrinsics or LDC bugtracker? Forum posts come and go, but issues stay.
Yeah will do.
Jan 30 2019