[Issue 7953] DMD Error: variable r used before set when compiling with -O
https://issues.dlang.org/show_bug.cgi?id=7953 Vladimir Panteleevchanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=10540 --
[Issue 7953] DMD Error: variable r used before set when compiling with -O
https://issues.dlang.org/show_bug.cgi?id=7953 --- Comment #7 from Walter Bright--- (In reply to SomeDude from comment #3) > but I can't reproduce the error message, so maybe I've overlooked something. > However, interestingly, this compiles with -O flag and crashes the compiler > without. > > PS E:\DigitalMars\dmd2\samples> rdmd bug.d > Internal error: ..\ztc\cg87.c 1699 This works without error in the current compiler. --
[Issue 7953] DMD Error: variable r used before set when compiling with -O
https://issues.dlang.org/show_bug.cgi?id=7953 Walter Brightchanged: What|Removed |Added Status|NEW |RESOLVED CC||bugzi...@digitalmars.com Resolution|--- |INVALID --- Comment #6 from Walter Bright --- float4 r; ... res.ptr[4] = r.ptr[4]; // Error: variable r used before set The error here is that there are only 4 entries in float4, and you're indexing the 5th one. If the function is marked @safe, it won't compile. Not a compiler bug. --
[Issue 7953] DMD Error: variable r used before set when compiling with -O
https://d.puremagic.com/issues/show_bug.cgi?id=7953 kekeni...@yahoo.co.jp changed: What|Removed |Added Keywords||SIMD CC||kekeni...@yahoo.co.jp --- Comment #5 from kekeni...@yahoo.co.jp 2014-01-22 18:54:54 PST --- (In reply to comment #0) When compiling this code with dmd -O it says: test.d(55) Error: variable r used before set i might have overlooked something, but shouldn't that compile? I tried to test on Windows. I suppose this is an _expected_ behavior. Maybe, 'r.ptr[4]' and its followings lines should be 'r.ptr[0]' and so on. Please help, SIMD expert... :) == Reduced Code: //DMDFLAGS=-O -m64 import core.simd; alias float[8] F8; F8 simdAdd(F8 a1, F8 a2) { F8 res; float4 v1; float4 v2; float4 r; // 0..4 OK v1.array = a1[0..4]; v2.array = a2[0..4]; r = __simd(XMM.ADDPS, v1,v2); res.ptr[0] = r.ptr[0]; res.ptr[1] = r.ptr[1]; res.ptr[2] = r.ptr[2]; res.ptr[3] = r.ptr[3]; // 4..8 NG v1.array = a1[4..8]; v2.array = a2[4..8]; r = __simd(XMM.ADDPS, v1,v2); res.ptr[4] = r.ptr[4]; // Error: variable r used before set res.ptr[5] = r.ptr[5]; res.ptr[6] = r.ptr[6]; res.ptr[7] = r.ptr[7]; return res; } -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7953] DMD Error: variable r used before set when compiling with -O
http://d.puremagic.com/issues/show_bug.cgi?id=7953 SomeDude lovelyd...@mailmetrash.com changed: What|Removed |Added CC||lovelyd...@mailmetrash.com --- Comment #2 from SomeDude lovelyd...@mailmetrash.com 2012-04-21 13:56:42 PDT --- Please reduce your code to the minimum that shows the behaviour. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7953] DMD Error: variable r used before set when compiling with -O
http://d.puremagic.com/issues/show_bug.cgi?id=7953 --- Comment #3 from SomeDude lovelyd...@mailmetrash.com 2012-04-21 14:17:06 PDT --- I've reduced the test case to this: import core.simd; import std.conv; string gen(int D) { string s; s ~= r = __simd(XMM.ADDPS, v1,v2);; return res.ptr[~to!string(0)~] = r.ptr[~to!string(0)~];; } T[D] simdAdd(T, int D)(T[D] a1, T[D] a2) { T[D] res; float4 r; mixin(gen(D)); return res; } void main() { float[8] v1 = [1,2,3,4,1,2,3,4]; float[8] v2 = [1,2,3,4,1,2,3,4]; simdAdd(v1,v2); } but I can't reproduce the error message, so maybe I've overlooked something. However, interestingly, this compiles with -O flag and crashes the compiler without. PS E:\DigitalMars\dmd2\samples rdmd bug.d Internal error: ..\ztc\cg87.c 1699 PS E:\DigitalMars\dmd2\samples rdmd -O bug.d PS E:\DigitalMars\dmd2\samples -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7953] DMD Error: variable r used before set when compiling with -O
http://d.puremagic.com/issues/show_bug.cgi?id=7953 --- Comment #4 from SomeDude lovelyd...@mailmetrash.com 2012-04-21 14:19:31 PDT --- (In reply to comment #3) I've reduced the test case to this: ... but I can't reproduce the error message, so maybe I've overlooked something. However, interestingly, this compiles with -O flag and crashes the compiler without. PS E:\DigitalMars\dmd2\samples rdmd bug.d Internal error: ..\ztc\cg87.c 1699 PS E:\DigitalMars\dmd2\samples rdmd -O bug.d PS E:\DigitalMars\dmd2\samples The ICE may be related to issue 7951. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7953] DMD Error: variable r used before set when compiling with -O
http://d.puremagic.com/issues/show_bug.cgi?id=7953 --- Comment #1 from Zoadian suicide...@xited.de 2012-04-20 12:32:53 PDT --- first one: suicide@zoaHTPC /media/code $ dmd test.d -release -noboundscheck -O test.d(55): Error: variable r used before set another one: suicide@zoaHTPC /media/code $ dmd test.d -release -noboundscheck -O -inline /usr/include/phobos2/std/datetime.d(29600): Error: variable std.path.sep is depr ecated /usr/include/phobos2/std/datetime.d(29601): Error: variable std.path.sep is depr ecated /usr/include/phobos2/std/path.d(2715): Error: alias std.path.onOutOfMemoryError is deprecated -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---