From d146d789d3482bebf361ae18055729fc2f0677c5 Mon Sep 17 00:00:00 2001 From: Walter Bright Date: Tue, 22 Nov 2016 02:39:58 -0800 Subject: [PATCH] fix Issue 12430 - non compile-time __simd opcode causes ICE --- src/e2ir.d | 7 +++++++ test/fail_compilation/test12430.d | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 test/fail_compilation/test12430.d diff --git a/src/e2ir.d b/src/e2ir.d index ad849ae40493..f95d3034db58 100644 --- a/src/e2ir.d +++ b/src/e2ir.d @@ -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: diff --git a/test/fail_compilation/test12430.d b/test/fail_compilation/test12430.d new file mode 100644 index 000000000000..49f6bc1dc6d2 --- /dev/null +++ b/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); +}