digitalmars.D.bugs - [Issue 8651] New: Slice op Slice throws exceptions (not errors), and nothrow
- d-bugmail puremagic.com Sep 13 2012
- d-bugmail puremagic.com Sep 15 2012
- d-bugmail puremagic.com Sep 25 2012
- d-bugmail puremagic.com Sep 25 2012
- d-bugmail puremagic.com Sep 25 2012
- d-bugmail puremagic.com Dec 17 2012
- d-bugmail puremagic.com Jan 01 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8651 Summary: Slice op Slice throws exceptions (not errors), and nothrow Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: monarchdodra gmail.com --- Comment #0 from monarchdodra gmail.com 2012-09-13 08:42:59 PDT --- 2 related problems: First -------- import std.stdio; void main() { try { int[] b = new int[](10); b[] = 5; b[0..6] = b[4..10]; } catch(Exception e) { writeln(e); } writeln("finish"); } -------- The built-in range assign will throw an Exception when it fails. This should be an Error. Second -------- nothrow void foo(int[] a) { a[] = a[]; } nothrow void bar(int[] a) { a[] += a[]; } -------- _arraySliceSliceAddass_i is not nothrow function main.bar 'bar' is nothrow yet may throw -------- This is doubly problematic: First, these methods should throw Errors, so the code should compile. Two, ironically, []+=[] currently doesn't throw anything, and []=[] throws an exception, yet it is the []+=[] version that doesn't compile. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 13 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8651 --- Comment #1 from monarchdodra gmail.com 2012-09-15 23:53:18 PDT --- Also, simple SlicoOp operations should be nothrow: nothrow void foo(int[] a) { a[] += 5; } Error: _arrayExpSliceAddass_i is not nothrow Error: function main.foo 'foo' is nothrow yet may throw nothrow void foo(int[] a) { a[] &= 5; } Error: _arrayExpSliceAddass_i is not nothrow Error: function main.foo 'foo' is nothrow yet may throw -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 15 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8651 --- Comment #2 from github-bugzilla puremagic.com 2012-09-25 16:34:27 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/92f92aa87c30370a2c7641499977dd0e53982540 trusted nothrow issue 8651 #8651 https://github.com/D-Programming-Language/druntime/commit/92f92aa87c30370a2c7641499977dd0e53982540 trusted nothrow issue 8651 #8651 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 25 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8651 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc --- Comment #3 from bearophile_hugs eml.cc 2012-09-25 16:43:44 PDT --- And someday even [1,2].dup will be nothrow. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 25 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8651 --- Comment #4 from monarchdodra gmail.com 2012-09-25 23:26:30 PDT --- (In reply to comment #3)And someday even [1,2].dup will be nothrow.
Doesn't dup allocate? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 25 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8651 --- Comment #5 from monarchdodra gmail.com 2012-12-17 00:10:00 PST --- (In reply to comment #0)2 related problems: First -------- import std.stdio; void main() { try { int[] b = new int[](10); b[] = 5; b[0..6] = b[4..10]; } catch(Exception e) { writeln(e); } writeln("finish"); } -------- The built-in range assign will throw an Exception when it fails. This should be an Error.
Confirmed fixed.Second -------- nothrow void foo(int[] a) { a[] = a[]; } nothrow void bar(int[] a) { a[] += a[]; } -------- _arraySliceSliceAddass_i is not nothrow function main.bar 'bar' is nothrow yet may throw -------- This is doubly problematic: First, these methods should throw Errors, so the code should compile. Two, ironically, []+=[] currently doesn't throw anything, and []=[] throws an exception, yet it is the []+=[] version that doesn't compile.
!!!!!!!! This is NOT FIXED. !!!!!!!! This is very strange, because arraySliceSliceAddass_i *is* marked as nothrow. However, when calling "a[] += a[]", I still get: ---- Error: _arraySliceSliceAddass_l is not nothrow ---- I'm not sure what to make about this? Maybe the "nothrow" info is lost in the "extern C" ? If I place the code as a unittest *inside* "src/rt/arrayint.d", then it passes. But outside of that source, then... It doesn't compile. We'd need one of the compiler guys (or just people that understand C and linking better than I do) to investigate. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 17 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8651 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yebblies gmail.com --- Comment #6 from yebblies <yebblies gmail.com> 2013-01-02 17:09:31 EST --- (In reply to comment #5)!!!!!!!! This is NOT FIXED. !!!!!!!! This is very strange, because arraySliceSliceAddass_i *is* marked as nothrow. However, when calling "a[] += a[]", I still get: ---- Error: _arraySliceSliceAddass_l is not nothrow ---- I'm not sure what to make about this? Maybe the "nothrow" info is lost in the "extern C" ? If I place the code as a unittest *inside* "src/rt/arrayint.d", then it passes. But outside of that source, then... It doesn't compile. We'd need one of the compiler guys (or just people that understand C and linking better than I do) to investigate.
Being C functions, the nothrowness is not part of the mangled name, otherwise that change would have caused lots of link failures. Inside the compiler (arrayop.c) a dummy function declaration is created with the correct name, and a call is inserted in place of the array op. This function declaration needs to be changed for the compiler to pick it up as nothrow, and it will need to be manually verified that the nothrowness matches at both ends for each function. A lot of druntime functions should probably have D linkage to prevent mistakes like this. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 01 2013









d-bugmail puremagic.com 