Skip to content

Commit

Permalink
fix Issue 12430 - non compile-time __simd opcode causes ICE
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Nov 22, 2016
1 parent 1e69da3 commit d146d78
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/e2ir.d
Expand Up @@ -187,6 +187,13 @@ elem *callfunc(Loc loc,
op = fd ? intrinsic_op(fd) : -1;
if (arguments)
{
if (op == OPvector)
{
Expression arg = (*arguments)[0];
if (arg.op != TOKint64)
arg.error("simd operator must be an integer constant, not '%s'", arg.toChars());
}

for (size_t i = 0; i < arguments.dim; i++)
{
Lagain:
Expand Down
19 changes: 19 additions & 0 deletions test/fail_compilation/test12430.d
@@ -0,0 +1,19 @@
/*
REQUIRED_ARGS: -m64
PERMUTE_ARGS:
TEST_OUTPUT:
---
fail_compilation/test12430.d(18): Error: simd operator must be an integer constant, not 'op'
---
*/

// https://issues.dlang.org/show_bug.cgi?id=12430

import core.simd;

void foo()
{
float4 a;
auto op = XMM.RSQRTPS;
auto b = __simd(op, a);
}

0 comments on commit d146d78

Please sign in to comment.