D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15728 - ICE while simd vec.f.array compared to ordinal array
Summary: ICE while simd vec.f.array compared to ordinal array
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 enhancement
Assignee: No Owner
URL:
Keywords: SIMD
Depends on:
Blocks:
 
Reported: 2016-02-26 22:49 UTC by Iakh
Modified: 2020-03-21 03:56 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Iakh 2016-02-26 22:49:12 UTC
Here is two cases:
1) pass vector by ref, return, compare, ...ICE
2) apply op, compare, fail with exit code -11

import core.simd;

int4 f()
{
    int4 vec;
    return vec;
}

void main()
{
    int4 vec;
    assert(f.array == [-1, -1, -1, -1]);
    /*
       catch-bug ~master: building configuration "application"...
       Internal error: backend/cod1.c 1669
       dmd failed with exit code 1.
       */

    //assert((-vec).array == [-1, -1, -1, -1]);
    /*
       catch-bug ~master: building configuration "application"...
       dmd failed with exit code -11.
       */
}

In second case could be used unary or binary operator (v1 & v2), (-vec), ...
DMD64 D Compiler v2.070
Comment 1 basile-z 2019-11-03 18:39:09 UTC
crashes are gone however there's another bug I'll open. Unary operators modify while they should return a modified copy.
Comment 2 basile-z 2019-11-03 18:42:51 UTC
No actually everything is fine

import core.simd;

int4 f()
{
    int4 vec = [-1, -1, -1, -1];
    return vec;
}

void main()
{
    assert(f().array == [-1, -1, -1, -1]);
    int4 v2 = f();
    assert(v2.array == [-1, -1, -1, -1]);

    int4 vec = [1, 1, 1, 1];
    assert((-vec).array == [-1, -1, -1, -1]);
    int4 neg = -vec;
    assert(neg.array == [-1, -1, -1, -1]);
    neg = -neg;
    assert(neg.array == [1, 1, 1, 1]);
}