Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 10, 2013 [Issue 9496] New: [REG 2.061 -> 2.062 alpha] "this[1 .. $]" passes wrong "this" to "opDollar" | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=9496 Summary: [REG 2.061 -> 2.062 alpha] "this[1 .. $]" passes wrong "this" to "opDollar" Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: monarchdodra@gmail.com --- Comment #0 from monarchdodra@gmail.com 2013-02-10 11:58:59 PST --- *************************************** NOTE: THIS ***JUST*** BROKE IN GIT HEAD. *************************************** I had this pull: https://github.com/D-Programming-Language/phobos/pull/992 Which was working fine, and then just spontaneously broke on the 8th: http://d.puremagic.com/test-results/pull-history.ghtml?projectid=1&repoid=3&pullid=992 Looks like a compiler or codegen bug: Basically, if, inside a member function, you want a slice, you'd write "this[a .. b]". Now, if you want to slice to the end, you'd write "this[a .. $]" problem is that in this specific case, the wrong "this" is passed to opDollar. What is strange is that it *only* happens when the words "this", and "$" are mixed together. It does not happen if you call "s[1 .. $]" or "this[1 .. opDollar()]": //---- import std.stdio; struct S { size_t opDollar() { writeln("Inside opDollar ", cast(void*)&this); return 10; } void opSlice(size_t , size_t) { writeln("Inside opSlice: ", cast(void*)&this); } void getSlice() { writeln("Inside get: ", cast(void*)&this); writeln("Normal"); this[1 .. opDollar()]; writeln("wait for it:"); this[1 .. $]; } } void main() { S s; writeln("Main: ", cast(void*)&s); s.getSlice(); writeln("not here:"); s[1 .. $]; } //---- Main: 18FD70 Inside get: 18FD70 Normal Inside opDollar 18FD70 Inside opSlice: 18FD70 wait for it: Inside opDollar 18FD74 <-- HERE: wrong this. Inside opSlice: 18FD70 not here: Inside opDollar 18FD70 Inside opSlice: 18FD70 //---- With more fancy scenarios, I've had more extreme values for this, including "0", "4" and "D" -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 10, 2013 [Issue 9496] [REG 2.061 -> 2.062 alpha] "this[1 .. $]" passes wrong "this" to "opDollar" | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9496 --- Comment #1 from monarchdodra@gmail.com 2013-02-10 11:59:32 PST --- (In reply to comment #0) > *************************************** > NOTE: THIS ***JUST*** BROKE IN GIT HEAD. > *************************************** Forgot to mention, the test case works correctly in 2.061. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 10, 2013 [Issue 9496] [REG 2.061 -> 2.062 alpha] "this[1 .. $]" passes wrong "this" to "opDollar" | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9496 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg@gmx.com Severity|major |regression -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 10, 2013 [Issue 9496] [REG 2.061 -> 2.062 alpha] "this[1 .. $]" passes wrong "this" to "opDollar" | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9496 Maxim Fomin <maxim@maxim-fomin.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxim@maxim-fomin.ru --- Comment #2 from Maxim Fomin <maxim@maxim-fomin.ru> 2013-02-10 12:23:46 PST --- (In reply to comment #0) > *************************************** > NOTE: THIS ***JUST*** BROKE IN GIT HEAD. > *************************************** Why so emotional? Instead you can be more informative by telling that it happens with -m32 (at least I cannot reproduce on linux with -m64). Why did you decide that recent dmd pulls break this code? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 10, 2013 [Issue 9496] [REG 2.061 -> 2.062 alpha] "this[1 .. $]" passes wrong "this" to "opDollar" | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9496 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich@gmail.com --- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-10 12:37:44 PST --- I can't reproduce this on win32. Can you specify which flags/platform you're using? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 10, 2013 [Issue 9496] [REG 2.061 -> 2.062 alpha] "this[1 .. $]" passes wrong "this" to "opDollar" | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9496 --- Comment #4 from Maxim Fomin <maxim@maxim-fomin.ru> 2013-02-10 12:44:35 PST --- I can reproduce on linux64 githead for both -m32 and m64 import core.stdc.stdio : printf; struct S { int i; size_t opDollar() { printf("Inside opDollar: %p\n", cast(void*)&this ); //i = 0; return 10; } void opSlice(size_t , size_t) { printf("Inside opSlice: %p\n", cast(void*)&this); } void getSlice() { printf("Inside get: %p\n", cast(void*)&this); this[1 .. $]; } } void main() { S s; s.getSlice(); } With -m32 and -m64 there is incorrect address in opDollar. With -inline it's fine, with -g there is AssertError ("null this") and with -O I have "Error: variable __dop5 used before set". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 10, 2013 [Issue 9496] [REG 2.061 -> 2.062 alpha] "this[1 .. $]" passes wrong "this" to "opDollar" | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9496 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- OS/Version|All |Linux --- Comment #5 from Jonathan M Davis <jmdavisProg@gmx.com> 2013-02-10 12:53:47 PST --- Yeah. On 64-bit Linux, I'm getting Main: 7FFF39C7A4D8 Inside get: 7FFF39C7A4D8 Normal Inside opDollar 7FFF39C7A4D8 Inside opSlice: 7FFF39C7A4D8 wait for it: Inside opDollar 10 Inside opSlice: 7FFF39C7A4D8 not here: Inside opDollar 7FFF39C7A4D8 Inside opSlice: 7FFF39C7A4D8 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 10, 2013 [Issue 9496] [REG 2.061 -> 2.062 alpha] "this[1 .. $]" passes wrong "this" to "opDollar" | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9496 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- OS/Version|Linux |All --- Comment #6 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-10 12:55:56 PST --- Introduced by commit: commit 6e2f1ec1abfacf61f9f156ccf5b814a3f6e26591 Author: k-hara <k.hara.pg@gmail.com> Date: Wed Feb 6 12:27:35 2013 +0900 fix Issue 9453 - ice(symbol.c) with slice on temporary -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 11, 2013 [Issue 9496] [REG 2.061 -> 2.062 alpha] "this[1 .. $]" passes wrong "this" to "opDollar" | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9496 --- Comment #7 from monarchdodra@gmail.com 2013-02-10 23:03:17 PST --- (In reply to comment #2) > (In reply to comment #0) > > *************************************** > > NOTE: THIS ***JUST*** BROKE IN GIT HEAD. > > *************************************** > > Why so emotional? Instead you can be more informative by telling that it happens with -m32 (at least I cannot reproduce on linux with -m64). Why did you decide that recent dmd pulls break this code? NOt really emotional, just clumsy I guess. I wanted to make sure to stress that something just broke: If we can easilly track down the change now, it greatly increases the chances of this being fixed, and may save someone hours of debugging. Apologies for forgetting to mention my version: Standard w32, with no switches. I also usually check linux 32/64 with dpaste, but the dpaste compiler has been down for a while, so I couldn't check. I decided a recent dmd pull breaks the code because my code spontaneously stopped working, and because I could reproduce the bug on something that does not depend on phobos. I'm not *blaming* anyone or anything. It's just that in my experience, fixing something is 10 times easier if you can track down *what* broke it in the first place. So I wanted to make sure we don't miss that window. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 11, 2013 [Issue 9496] [REG 2.061 -> 2.062 alpha] "this[1 .. $]" passes wrong "this" to "opDollar" | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarchdodra@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=9496 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull, wrong-code --- Comment #8 from Kenji Hara <k.hara.pg@gmail.com> 2013-02-10 23:19:20 PST --- https://github.com/D-Programming-Language/dmd/pull/1655 (In reply to comment #7) > NOt really emotional, just clumsy I guess. I wanted to make sure to stress that something just broke: If we can easilly track down the change now, it greatly increases the chances of this being fixed, and may save someone hours of debugging. I especially observe regression issues, at least in beta phase. To me, "Importance: regression" is enough. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation