re PR d/90604 (ICE in sizemask, at d/dmd/mtype.c:2542)
authorIain Buclaw <ibuclaw@gcc.gnu.org>
Sun, 16 Jun 2019 07:48:42 +0000 (07:48 +0000)
committerIain Buclaw <ibuclaw@gcc.gnu.org>
Sun, 16 Jun 2019 07:48:42 +0000 (07:48 +0000)
PR d/90604
d/dmd: Merge upstream dmd f30c5dc79

Fixes internal compiler error in Type::sizemask.

Reviewed-on: https://github.com/dlang/dmd/pull/9998

From-SVN: r272343

gcc/d/dmd/MERGE
gcc/d/dmd/intrange.c
gcc/testsuite/gdc.test/fail_compilation/fail19898a.d [new file with mode: 0644]
gcc/testsuite/gdc.test/fail_compilation/fail19898b.d [new file with mode: 0644]

index 7456d60..4cb2bba 100644 (file)
@@ -1,4 +1,4 @@
-420cce2a654f14b8de4a75cbb5d4203fce8d4e0f
+f30c5dc790c17914463879157447acc671518735
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/dmd repository.
index 940385c..e0e2472 100644 (file)
@@ -278,7 +278,7 @@ IntRange IntRange::fromType(Type *type)
 
 IntRange IntRange::fromType(Type *type, bool isUnsigned)
 {
-    if (!type->isintegral())
+    if (!type->isintegral() || type->toBasetype()->ty == Tvector)
         return widest();
 
     uinteger_t mask = type->sizemask();
@@ -404,7 +404,7 @@ IntRange& IntRange::castDchar()
 
 IntRange& IntRange::cast(Type *type)
 {
-    if (!type->isintegral())
+    if (!type->isintegral() || type->toBasetype()->ty == Tvector)
         return *this;
     else if (!type->isunsigned())
         return castSigned(type->sizemask());
@@ -416,7 +416,7 @@ IntRange& IntRange::cast(Type *type)
 
 IntRange& IntRange::castUnsigned(Type *type)
 {
-    if (!type->isintegral())
+    if (!type->isintegral() || type->toBasetype()->ty == Tvector)
         return castUnsigned(UINT64_MAX);
     else if (type->toBasetype()->ty == Tdchar)
         return castDchar();
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19898a.d b/gcc/testsuite/gdc.test/fail_compilation/fail19898a.d
new file mode 100644 (file)
index 0000000..406e468
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+PERMUTE_ARGS:
+REQUIRED_ARGS: -m64
+TEST_OUTPUT:
+---
+fail_compilation/fail19898a.d(11): Error: incompatible types for `(__key2) < (__limit3)`: both operands are of type `__vector(int[4])`
+---
+*/
+void f (__vector(int[4]) n)
+{
+    foreach (i; 0 .. n)
+        cast(void)n;
+}
+
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19898b.d b/gcc/testsuite/gdc.test/fail_compilation/fail19898b.d
new file mode 100644 (file)
index 0000000..0b47fb7
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+PERMUTE_ARGS:
+REQUIRED_ARGS: -m64
+TEST_OUTPUT:
+---
+fail_compilation/fail19898b.d(18): Error: cannot implicitly convert expression `m` of type `S` to `__vector(int[4])`
+fail_compilation/fail19898b.d(18): Error: incompatible types for `(__key2) != (__limit3)`: both operands are of type `__vector(int[4])`
+fail_compilation/fail19898b.d(18): Error: cannot cast expression `__key2` of type `__vector(int[4])` to `S`
+---
+*/
+struct S
+{
+    int a;
+}
+
+void f (__vector(int[4]) n, S m)
+{
+    foreach (i; m .. n)
+        cast(void)n;
+}
+