[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 --- Comment #20 from github-bugzi...@puremagic.com --- Commit pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/66187b5c1e1554cd6e417e3c762285d0234bb982 fix Issue 8838 - Slicing static arrays should be considered unsafe (@system) --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 github-bugzi...@puremagic.com changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |FIXED --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 Piotr Szturmaj changed: What|Removed |Added CC|psztur...@tlen.pl | --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 Martin Nowak changed: What|Removed |Added Status|RESOLVED|REOPENED CC||c...@dawg.eu Resolution|FIXED |--- --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 --- Comment #19 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/66187b5c1e1554cd6e417e3c762285d0234bb982 fix Issue 8838 - Slicing static arrays should be considered unsafe (@system) --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 --- Comment #18 from github-bugzi...@puremagic.com --- Commit pushed to scope at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/66187b5c1e1554cd6e417e3c762285d0234bb982 fix Issue 8838 - Slicing static arrays should be considered unsafe (@system) --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 --- Comment #17 from Walter Bright --- Fixed by: https://github.com/dlang/dmd/pull/5972 --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 Nick Treleaven changed: What|Removed |Added CC||ntrel-...@mybtinternet.com See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=12625 --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 --- Comment #16 from Walter Bright --- The first case no longer compiles, but the second case remains. --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 --- Comment #15 from Jonathan M Davis --- Related: issue# 15932 --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 --- Comment #14 from Steven Schveighoffer --- (In reply to yebblies from comment #8) > This is not very easy, because the compiler lowers all static array > assignment to slice assignment, making _every_ static array assignment > unsafe. That needs to be fixed first, and requires extensive changes in the > interpreter. Can you just ban slicing that escapes the statement? --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 Jonathan M Davis changed: What|Removed |Added Severity|normal |major --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 --- Comment #13 from hst...@quickfur.ath.cx --- Hmm. Seems like if we implement 'scope' according to some combination of current proposals, we might be able to address this by having slices of static arrays return a scoped slice with lifetime not longer than the static array itself. --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 David Nadlinger changed: What|Removed |Added Keywords||safe CC||c...@klickverbot.at --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 Steven Schveighoffer changed: What|Removed |Added CC||schvei...@yahoo.com --- Comment #12 from Steven Schveighoffer --- One thing to note here. A workaround is to use the temporary @trusted delegate to do the slicing. --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://issues.dlang.org/show_bug.cgi?id=8838 Walter Bright changed: What|Removed |Added CC||bugzi...@digitalmars.com Version|unspecified |D2 --
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://d.puremagic.com/issues/show_bug.cgi?id=8838 --- Comment #11 from yebblies 2013-11-25 12:18:07 EST --- (In reply to comment #10) > (In reply to comment #8) > > This is not very easy, because the compiler lowers all static array > > assignment > > to slice assignment, making _every_ static array assignment unsafe. That > > needs > > to be fixed first, and requires extensive changes in the interpreter. > > Perhaps related, for optimization, and equally important: > https://d.puremagic.com/issues/show_bug.cgi?id=10305 No, not related. And not anywhere near as important. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://d.puremagic.com/issues/show_bug.cgi?id=8838 --- Comment #10 from bearophile_h...@eml.cc 2013-11-24 16:15:12 PST --- (In reply to comment #8) > This is not very easy, because the compiler lowers all static array assignment > to slice assignment, making _every_ static array assignment unsafe. That > needs > to be fixed first, and requires extensive changes in the interpreter. Perhaps related, for optimization, and equally important: https://d.puremagic.com/issues/show_bug.cgi?id=10305 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://d.puremagic.com/issues/show_bug.cgi?id=8838 --- Comment #9 from Jonathan M Davis 2013-11-24 14:21:13 PST --- > This is not very easy, because the compiler lowers all static array assignment > to slice assignment, making _every_ static array assignment unsafe. That > needs to be fixed first, and requires extensive changes in the interpreter. Well, that's not good to hear, but unfortunately, I really don't think that the change is negotiable given what @safe is supposed to do and mean. So, even if it takes a while, it's something that needs to happen. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
https://d.puremagic.com/issues/show_bug.cgi?id=8838 --- Comment #8 from yebblies 2013-11-24 21:41:27 EST --- This is not very easy, because the compiler lowers all static array assignment to slice assignment, making _every_ static array assignment unsafe. That needs to be fixed first, and requires extensive changes in the interpreter. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
http://d.puremagic.com/issues/show_bug.cgi?id=8838 yebblies changed: What|Removed |Added CC||acehr...@yahoo.com --- Comment #7 from yebblies 2013-07-28 16:41:54 EST --- *** Issue 7087 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
http://d.puremagic.com/issues/show_bug.cgi?id=8838 yebblies changed: What|Removed |Added CC||yebbl...@gmail.com Severity|enhancement |normal -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
http://d.puremagic.com/issues/show_bug.cgi?id=8838 yebblies changed: What|Removed |Added CC||psztur...@tlen.pl --- Comment #6 from yebblies 2012-12-27 02:24:46 EST --- *** Issue 6844 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
http://d.puremagic.com/issues/show_bug.cgi?id=8838 --- Comment #5 from Jonathan M Davis 2012-10-17 16:57:55 PDT --- > The code segment must be rejected, but what makes it unsafe is the escaping. > Banning the slicing is not very precise. It's exactly what happens with taking the address of a local variable. It's an error if the compiler can determine that it's escaping, but it's @system regardless. And because the compiler _can't_ guarantee that the reference isn't escaping, it really has no choice but to make it @system to take the address or slice in the first place. Doing otherwise would mean that it's possible to have memory corruption issues when only using @safe code, which would be violating @safe. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
http://d.puremagic.com/issues/show_bug.cgi?id=8838 --- Comment #4 from bearophile_h...@eml.cc 2012-10-17 16:47:12 PDT --- (In reply to comment #3) > The code segment must be rejected, but what makes it unsafe is the escaping. > Banning the slicing is not very precise. Region analysis is not one of the design goals of D, unfortunately. But a little of such analysis will be useful in the D front-end. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
http://d.puremagic.com/issues/show_bug.cgi?id=8838 timon.g...@gmx.ch changed: What|Removed |Added CC||timon.g...@gmx.ch --- Comment #3 from timon.g...@gmx.ch 2012-10-17 16:42:44 PDT --- (In reply to comment #2) > > This is a big change in D, so before going this route I suggest to think > > well > about this topic. > > The thing is that it _isn't_ memory safe. There's no question of that. So, per > the definition of @safe, it has no business being @safe. It needs to be > @system. If it's not, then SafeD is broken. I don't see how anyone could argue > otherwise. > ... The code segment must be rejected, but what makes it unsafe is the escaping. Banning the slicing is not very precise. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
http://d.puremagic.com/issues/show_bug.cgi?id=8838 --- Comment #2 from Jonathan M Davis 2012-10-17 16:35:57 PDT --- > This is a big change in D, so before going this route I suggest to think well about this topic. The thing is that it _isn't_ memory safe. There's no question of that. So, per the definition of @safe, it has no business being @safe. It needs to be @system. If it's not, then SafeD is broken. I don't see how anyone could argue otherwise. Yes, it's breaking change in the cases where people actually use @safe, but there's no way around that, and honestly, I suspect that most people don't mark their code @safe anyway, and it's only applicable to where static arrays are sliced, so I don't know how much code will really be broken. For folks who use static arrays and @safe heavily, it'll break a lot. For most other people, probably nothing. Regardless, I don't see how we can _not_ make this change given what @safe is supposed to do. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8838] Slicing static arrays should be considered unsafe (@system)
http://d.puremagic.com/issues/show_bug.cgi?id=8838 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment #1 from bearophile_h...@eml.cc 2012-10-17 15:23:41 PDT --- (In reply to comment #0) > Taking the slice of a static array is really no different from taking the > address of a local variable, and that's already @system, so slicing a static > array should be as well. This is a big change in D, so before going this route I suggest to think well about this topic. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---