Bug 17721 – Wrong expression type using vector extensions with shift operands

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-08-04T23:59:44Z
Last change time
2017-08-16T13:24:21Z
Assigned to
Iain Buclaw
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2017-08-04T23:59:44Z
The operands encapsulated by the following classes have a result type that is implicitly bool. CmpExp EqualExp IdentityExp The operands encapsulated by the following classes have a result type that is implicitly int. ShlExp ShrExp UshrExp When handling vectors, the resultant type of the expression should also be a vector. i.e: --- float4 f1 = [1, 9, 8, 9]; float4 f2 = [2, 8, 0, 5]; float4 fr = f1 > f2; assert((f1 > f2).array == [0, -1, -1, -1]); int4 i1 = [1, 2, 3, 4]; int4 i2 = [2, 4, 8, 16]; int4 ir = i1 << i2; assert(ir.array == [4, 32, 768, 262144]); --- This is not a concern for dmd, who rejects these operands.
Comment #1 by bugzilla — 2017-08-07T01:32:37Z
Comment #2 by github-bugzilla — 2017-08-10T00:34:26Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/b77ccc136b62983d86f6f7ecc61a993c6a0ce305 fix Issue 17721 - Wrong expression type using vector extensions with shift operands https://github.com/dlang/dmd/commit/ba062f7c87fcdba6cfed71ffd9a27527cf299d33 Merge pull request #7066 from ibuclaw/issue17721 fix Issue 17721 - Wrong expression type using vector extensions with shift operands merged-on-behalf-of: Walter Bright <[email protected]>
Comment #3 by github-bugzilla — 2017-08-16T13:24:21Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/b77ccc136b62983d86f6f7ecc61a993c6a0ce305 fix Issue 17721 - Wrong expression type using vector extensions with shift operands https://github.com/dlang/dmd/commit/ba062f7c87fcdba6cfed71ffd9a27527cf299d33 Merge pull request #7066 from ibuclaw/issue17721