Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__vector << int produce ICE, should be illegal? #3606

Closed
p0nce opened this issue Nov 3, 2020 · 3 comments · Fixed by #4781
Closed

__vector << int produce ICE, should be illegal? #3606

p0nce opened this issue Nov 3, 2020 · 3 comments · Fixed by #4781
Labels

Comments

@p0nce
Copy link
Contributor

p0nce commented Nov 3, 2020

The following program crashes LDC 1.24.0 and below too:

import core.simd;
void fun()
{
    int4 A;
    A = A << 8;
}

Output with LDC 1.24:

#1 with ldc beta
sext source and destination must both be a vector or neither
  %5 = sext i32 8 to <4 x i32>
in function _D7example3funFAAyaZv
LLVM ERROR: Broken function found, compilation aborted!
/opt/compiler-explorer/ldcbeta/bin/ldc2[0x33f03d4]
Compiler returned: 255

DMD output is correct:

<source>(6): Error: incompatible types for `(A) << (8)`: `__vector(int[4])` and `int`
Compiler returned: 1

Interestingly it used to work in LDC 1.4.0 but doesn't since LDC 1.5.0 in Godbolt: https://d.godbolt.org/z/3Eb47n

@p0nce p0nce changed the title __vector << int crash should be illegal __vector << int produce ICE, should be illegal Nov 3, 2020
@kinke
Copy link
Member

kinke commented Nov 3, 2020

I disagree, this should be legal, because A << int4(8) works with LDC (unlike DMD). The frontend implicitly casts scalars to vectors for arithmetic ops (* 2 => * cast(int4) 2), but apparently not for shifts.

@p0nce
Copy link
Contributor Author

p0nce commented Nov 3, 2020

I have no opinion about this ¯_(ツ)_/¯

@p0nce p0nce changed the title __vector << int produce ICE, should be illegal __vector << int produce ICE, should be illegal? Nov 3, 2020
@CecilSWard
Copy link

This kind of expression does work in the latest GDC available in Godbolt as of 2023-06-12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants