Skip to content

Commit

Permalink
Merge pull request #4206 from 9rnsr/fix13841
Browse files Browse the repository at this point in the history
Issue 13841 - infinite loop in compiler on simd arithmetic
  • Loading branch information
MartinNowak committed Dec 10, 2014
2 parents c23d482 + e4bacee commit 49fd376
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cast.c
Expand Up @@ -2934,6 +2934,12 @@ int typeMerge(Scope *sc, Expression *e, Type **pt, Expression **pe1, Expression
e1 = e1->castTo(sc, t);
e2 = e2->castTo(sc, t);
}
else if (t1->ty == Tvector && t2->ty == Tvector)
{
// Bugzilla 13841, all vector types should have no common types between
// different vectors, even though their sizes are same.
goto Lincompatible;
}
else if (t1->ty == Tvector && t2->ty != Tvector &&
e2->implicitConvTo(t1))
{
Expand Down
28 changes: 28 additions & 0 deletions test/runnable/testxmm.d
Expand Up @@ -7,6 +7,8 @@ import core.simd;
import core.stdc.string;
import std.stdio;

alias TypeTuple(T...) = T;

/*****************************************/

void test1()
Expand Down Expand Up @@ -1208,6 +1210,32 @@ void test9449_2()
assert(m[1][3] == 8);
}

/*****************************************/
// 13841

void test13841()
{
alias Vector16s = TypeTuple!(
void16, byte16, short8, int4, long2,
ubyte16, ushort8, uint4, ulong2, float4, double2);
foreach (V1; Vector16s)
{
foreach (V2; Vector16s)
{
V1 v1 = void;
V2 v2 = void;
static if (is(V1 == V2))
{
static assert( is(typeof(true ? v1 : v2) == V1));
}
else
{
static assert(!is(typeof(true ? v1 : v2)));
}
}
}
}

/*****************************************/

int main()
Expand Down

0 comments on commit 49fd376

Please sign in to comment.