re PR d/90604 (ICE in sizemask, at d/dmd/mtype.c:2542)

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
This commit is contained in:
Iain Buclaw 2019-06-16 07:48:42 +00:00
parent e7c6715ec8
commit 70106db926
4 changed files with 39 additions and 4 deletions

View 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.

View 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();

View File

@ -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;
}

View File

@ -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;
}