https://issues.dlang.org/show_bug.cgi?id=24657
elpenguin...@gmail.com changed:
What|Removed |Added
CC||elpenguin...@gmail.com
--- Comment
https://issues.dlang.org/show_bug.cgi?id=24657
Walter Bright changed:
What|Removed |Added
Keywords||safe
--
https://issues.dlang.org/show_bug.cgi?id=24657
Issue ID: 24657
Summary: 0-sized struct should be rejected in @safe mode
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
s changing @system field in @safe code
https://github.com/dlang/dmd/pull/16625
--
created dlang/dmd pull request #16625 "Fix Bugzilla 24631 - Pointer cast
allows changing @system field in @s…" fixing this issue:
- Fix Bugzilla 24631 - Pointer cast allows changing @system field in @safe code
https://github.com/dlang/dmd/pull/16625
--
https://issues.dlang.org/show_bug.cgi?id=24631
Nick Treleaven changed:
What|Removed |Added
Keywords||safe
--
https://issues.dlang.org/show_bug.cgi?id=24631
Issue ID: 24631
Summary: Pointer cast allows changing @system field in @safe
code
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Treleaven ---
> Either way, the message given by the compiler is wrong
Not sure if it changed, but the message now is:
safesetunion.d(8): Error: field `Foo.b` cannot access pointers in `@safe` code
that overlap other fields
--
|--- |FIXED
--- Comment #2 from Dlang Bot ---
dlang/dmd pull request #16584 "Fix Bugzilla 24603 - Can copy from non-void
array into void[] in safe…" was merged into master:
- f42dc60597bc904bee9b2377877d511f9dae3cf5 by Nick Treleaven:
Fix Bugzilla 24603 - Can copy from non-
Treleaven ---
Writing to a `void[]` cannot be @safe:
```d
string msg = "Hello world";
auto client = HTTP("dlang.org");
client.onSend = delegate size_t(void[] data)
{
auto m = cast(void[]) msg;
size_t length = m.length > data.length ? data.length : m.length;
if
created dlang/dmd pull request #16584 "Fix Bugzilla 24603 - Can copy
from non-void array into void[] in safe…" fixing this issue:
- Fix Bugzilla 24603 - Can copy from non-void array into void[] in safe code
Deprecate in safe code.
https://github.com/dlang/dmd/pull/16584
--
https://issues.dlang.org/show_bug.cgi?id=24603
Nick Treleaven changed:
What|Removed |Added
Keywords||safe
--
https://issues.dlang.org/show_bug.cgi?id=24603
Nick Treleaven changed:
What|Removed |Added
Severity|enhancement |normal
--
https://issues.dlang.org/show_bug.cgi?id=24603
Issue ID: 24603
Summary: Can copy from non-void array into void[] in safe code
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity
);
assert(a == 0b); // what actually happens
assert(a == 0b1110); // what would be safe
}
```
[...]
Do I corrupt memory here or not ?
Is that a safety violation ?
`cast(bool*)` is a safety violation.
The only [safe values][1] for a `bool` are 0 (false) and 1
(true
assert(a == 0b1110); // what would be safe
}
```
[...]
Do I corrupt memory here or not ?
Is that a safety violation ?
`cast(bool*)` is a safety violation.
The only [safe values][1] for a `bool` are 0 (false) and 1
(true). By creating a `bool*` that points to a different value
On Wednesday, 5 June 2024 at 09:09:40 UTC, Kagamin wrote:
On Wednesday, 5 June 2024 at 01:18:06 UTC, Paul Backus wrote:
The only safe values for a `bool` are 0 (false) and 1 (true).
AFAIK that was fixed and now full 8-bit range is safe.
`cast(bool) someByte` is fine - that doesn't
On Wednesday, 5 June 2024 at 01:18:06 UTC, Paul Backus wrote:
The only safe values for a `bool` are 0 (false) and 1 (true).
AFAIK that was fixed and now full 8-bit range is safe.
where the situation is unclear. How do
`ubytes` other than 1 or 0, when viewed as bools? We probably can't say
it's undefined behaviour, since it is allowed in `@safe`.
How I would define it, is that it's unspecific behaviour. That is if you
have
```D
bool* unspecified = cast(bool*) new ubyte
On Wednesday, 5 June 2024 at 05:15:42 UTC, Olivier Pisano wrote:
This is technically not a memory corruption, because as
bool.sizeof < int.sizeof, you just write the low order byte of
an int you allocated on the stack.
It was not an int, it was a ushort. Anyway, what I wrote still
applies.
corruption.
Do I corrupt memory here or not ?
Is that a safety violation ?
The problem is that while setIt() is @safe, your main function is
not. So the pointer cast (which is not @safe) is permitted.
A bool is a 1 byte type with two possible values : false (0) and
true (1).
When you set
On Wednesday, 5 June 2024 at 01:18:06 UTC, Paul Backus wrote:
On Tuesday, 4 June 2024 at 16:58:50 UTC, Basile B. wrote:
you have violated the language's safety invariants.
ah mais non.
On Tuesday, 4 June 2024 at 16:58:50 UTC, Basile B. wrote:
```d
void main(string[] args)
{
ushort a = 0b;
bool* b = cast(bool*)
setIt(*b);
assert(a == 0b); // what actually happens
assert(a == 0b1110); // what would be safe
On Tuesday, 4 June 2024 at 16:58:50 UTC, Basile B. wrote:
question in the header, code in the body, execute on a X86 or
X86_64 CPU
```d
module test;
void setIt(ref bool b) @safe
{
b = false;
}
void main(string[] args)
{
ushort a = 0b;
bool* b = cast(bool
On Tuesday, 4 June 2024 at 16:58:50 UTC, Basile B. wrote:
question in the header, code in the body, execute on a X86 or
X86_64 CPU
```d
module test;
void setIt(ref bool b) @safe
{
b = false;
}
void main(string[] args)
{
ushort a = 0b;
bool* b = cast(bool
question in the header, code in the body, execute on a X86 or
X86_64 CPU
```d
module test;
void setIt(ref bool b) @safe
{
b = false;
}
void main(string[] args)
{
ushort a = 0b;
bool* b = cast(bool*)
setIt(*b);
assert(a == 0b); // what
https://issues.dlang.org/show_bug.cgi?id=19916
Nick Treleaven changed:
What|Removed |Added
CC||n...@geany.org
--- Comment #24 from Nick
https://code.dlang.org/packages/rust_interop_d
wrapped:
DashMap: is an implementation of a concurrent associative
array/hashmap in Rust.
be foolish.
But this set me searching through the library for a standard
Associative Array construct which _is_ thread safe? It didn't
jump out at me. I know I can place such a thing within a
synchronized class, but I was wondering if there's a standard AA
which has the standard usage but is safe w
https://issues.dlang.org/show_bug.cgi?id=24552
Nick Treleaven changed:
What|Removed |Added
CC||n...@geany.org
--- Comment #1 from Nick
https://issues.dlang.org/show_bug.cgi?id=24552
Issue ID: 24552
Summary: cast to immutable in @safe not rejected
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: accepts-invalid
|--- |FIXED
--- Comment #5 from Dlang Bot ---
dlang/dmd pull request #16315 "Fix Bugzilla 24434 - Casting away const with
cast() is not a @safe lv…" was merged into master:
- c2eac7ce389eb174cfbb96e66ab4fddb1b48a4b2 by Nick Treleaven:
Workaround for safe append
Fixes Bugz
shouldn't be allowed in `@safe`
https://github.com/dlang/dmd/pull/16356
--
https://issues.dlang.org/show_bug.cgi?id=24477
ag0aep6g changed:
What|Removed |Added
CC||ag0ae...@gmail.com
--
---
@dkorpel created dlang/dmd pull request #16356 "Fix bugzilla 24477 - Union
access of bool shouldn't be allowed in `@s…" fixing this issue:
- Fix bugzilla 24477 - Union access of bool shouldn't be allowed in `@safe`
https://github.com/dlang/dmd/pull/16356
--
https://issues.dlang.org/show_bug.cgi?id=24477
Issue ID: 24477
Summary: Union access of bool shouldn't be allowed in @safe
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: safe
https://issues.dlang.org/show_bug.cgi?id=24470
Marcelo Silva Nascimento Mancini changed:
What|Removed |Added
Status|NEW |RESOLVED
https://issues.dlang.org/show_bug.cgi?id=24470
Issue ID: 24470
Summary: Type safe variadic arguments of delegates cause
implicit conversion into lazy
Product: D
Version: D2
Hardware: x86
OS: Windows
https://issues.dlang.org/show_bug.cgi?id=21675
Nick Treleaven changed:
What|Removed |Added
CC||n...@geany.org
--- Comment #3 from Nick
nitializer causes undefined
behavior in @safe code
https://github.com/dlang/dmd/pull/16347
--
https://issues.dlang.org/show_bug.cgi?id=24098
--- Comment #5 from Dlang Bot ---
dlang/dlang.org pull request #3789 "[spec/function] Fix Safe Interface
definition" was merged into master:
- e3fd3f0e5bebb9884e05a1bc9031176a682df365 by Nick Treleaven:
[spec] Fix Safe interface defin
https://issues.dlang.org/show_bug.cgi?id=23530
--- Comment #4 from Dlang Bot ---
@ntrel updated dlang/dmd pull request #16315 "Fix Bugzilla 24434 - Casting away
const with cast() is not a @safe lv…" fixing this issue:
- Workaround for safe append
Fixes Bugzilla 23530 - casting immu
```d
@safe:
void foo ()
{
import std.typecons : SafeRefCounted;
SafeRefCounted!int s;
}
unittest {
import std.exception : assertNotThrown;
assertNotThrown (foo);
}
```
```
$ dmd -unittest -main -run sr.d
sr.d(6): Error: `@safe` function `sr.foo` cannot call `@system`
destructor
https://issues.dlang.org/show_bug.cgi?id=24098
--- Comment #4 from Dlang Bot ---
@ntrel created dlang/dlang.org pull request #3789 "[spec] Fix Safe interface
definition" mentioning this issue:
- [spec] Fix Safe interface definition
1. Mention context and globals for preconditio
clearly it violates requirement 1 and the preconditions hold (the
> preconditions do not say anything about the state of global variables).
Yes, I think the preconditions need to mention safe context:
> When it is only called with safe values and safe aliasing
--
https://issues.dlang.org/show_bug.cgi?id=22944
anonymous4 changed:
What|Removed |Added
Hardware|x86_64 |All
OS|Linux
https://issues.dlang.org/show_bug.cgi?id=22944
anonymous4 changed:
What|Removed |Added
Keywords||diagnostic
--
on||24391
Referenced Issues:
https://issues.dlang.org/show_bug.cgi?id=24391
[Issue 24391] std.encoding.sanitize should be usable in @safe
--
://issues.dlang.org/show_bug.cgi?id=18110
[Issue 18110] most of phobos should be @safe-ly useable
--
https://issues.dlang.org/show_bug.cgi?id=24391
Issue ID: 24391
Summary: std.encoding.sanitize should be usable in @safe
Product: D
Version: D2
Hardware: x86
OS: All
Status: NEW
Severity: enhancement
/automem
I'm not familiar with automem, and I'm not numem primary author.
Goals seems very similar and from a cursory reading:
- automem is much further along on many points such as: attribute
forwarding, @nogc, @safe, DIP1000, allocator support, ranges,
support for GC roots, and exists since 6 years
On Saturday, 30 December 2023 at 15:17:36 UTC, Luna wrote:
NuMem 0.5.4 has been released, numem is a new library
Any meaningful comparison with another similar library will be
highly appreciated
https://code.dlang.org/packages/automem
On Saturday, 30 December 2023 at 16:36:38 UTC, ryuukk_ wrote:
We plan to add more memory management utilities, thereby
making writing completely GC-less D code a lot more
user-friendly.
I'd be happy to help
What D really is missing _right now_, and will hopefully get
_before_ phobosv3 is a
On Saturday, 30 December 2023 at 16:36:38 UTC, ryuukk_ wrote:
What D really is missing _right now_, and will hopefully get
_before_ phobosv3 is a good and minimalistic Allocator API, i
modeled mine around zig's, no RAII, just a simple struct with 3
function ptr
FWIW it's possible to do a
We plan to add more memory management utilities, thereby making
writing completely GC-less D code a lot more user-friendly.
I'd be happy to help
What D really is missing _right now_, and will hopefully get
_before_ phobosv3 is a good and minimalistic Allocator API, i
modeled mine around
Nice, thanks for sharing, it'll be very useful for the C++
developers who want to give D a try
On Saturday, 30 December 2023 at 15:17:36 UTC, Luna wrote:
* C++ style smart pointers (unique_ptr, shared_ptr, weak_ptr)
* C++ style vector type (with support for moving unique_ptr's
in!)
Indeed with numem you can have a relatively "C++11" experience
with scoped ownership, which we intend
NuMem 0.5.4 has been released, numem is a new library I am
developing with contributions from Auburn Sounds/p0nce. It's
meant to provide safer ways of writing nogc code, which is
sometimes neccesary when the D garbage collector would be an
unoptimal choice.
NuMem currently features:
* C++
assing non-copyable struct by
value in @safe code
If a copy constructor is explicitly marked with @disable, the error
message should mention that, regardless of whether its attributes are
allowed in the calling scope.
https://github.com/dlang/dmd/pull/15953
--
---
@pbackus created dlang/dmd pull request #15953 "Fix 24301 - Misleading error
message when passing non-copyable struct…" fixing this issue:
- Fix 24301 - Misleading error message when passing non-copyable struct by
value in @safe code
If a copy constructor is explicitly marked with @disable,
https://issues.dlang.org/show_bug.cgi?id=24301
--- Comment #1 from Paul Backus ---
Introduced in this PR:
https://github.com/dlang/dmd/pull/14015
--
https://issues.dlang.org/show_bug.cgi?id=24301
Paul Backus changed:
What|Removed |Added
Keywords||diagnostic
--
https://issues.dlang.org/show_bug.cgi?id=24301
Issue ID: 24301
Summary: [REG 2.100] Misleading error message when passing
non-copyable struct by value in @safe code
Product: D
Version: D2
Hardware: All
OS
https://forum.dlang.org/post/xozbnrpxmgxboykir...@forum.dlang.org
On Tuesday, 14 February 2023 at 14:22:42 UTC, Rey Valeza wrote:
On Saturday, 23 April 2022 at 05:12:30 UTC, Steven
Schveighoffer wrote:
[...]
Hi Steve, I just want you to know that I updated the Vibe.d
tutorial I wrote last
On Tuesday, 14 February 2023 at 14:22:42 UTC, Rey Valeza wrote:
On Saturday, 23 April 2022 at 05:12:30 UTC, Steven
Schveighoffer wrote:
[...]
Hi Steve, I just want you to know that I updated the Vibe.d
tutorial I wrote last year to emphasize database operations
using mysql-native and is now
On Friday, December 8, 2023 10:13:21 AM MST Dmitry Ponyatov via Digitalmars-d-
learn wrote:
> What's wrong with using non@safe actions which creates and
> modifies some external objects?
>
> ```D
> class Layer {
> int index;
> string name;
> this(int index,
What's wrong with using non@safe actions which creates and
modifies some external objects?
```D
class Layer {
int index;
string name;
this(int index, string name) {
class SignalLayer : Layer {
class UserLayer : Layer {
class PCB {
Layer[] layer;
PT _deflayer(PT)(PT p
https://issues.dlang.org/show_bug.cgi?id=24275
timon.g...@gmx.ch changed:
What|Removed |Added
Severity|enhancement |normal
--
https://issues.dlang.org/show_bug.cgi?id=24275
Issue ID: 24275
Summary: pragma(mangle, ...) can hijack safe functions,
bypassing @safe checks
Product: D
Version: D2
Hardware: x86_64
OS: Linux
.
- It doesn't use pointers, UDA-ified variable are accessed
without intermediary.
- It's faster than the phobos one (although getopt is never a
bottleneck)
- It's `@safe` and can be even `nothrow`
It could be easily added to phobos (just need to convert some
EnumSet to BitFlag).
- code:
https
|--- |FIXED
--- Comment #2 from Dlang Bot ---
dlang/dmd pull request #15817 "Fix 20332 - associative array clear function
should be @safe" was merged into master:
- f952d190e8fab236c2782c7d04dda58900dfc9ab by Dennis Korpel:
Fix 20332 - associative array clear function should be @s
---
@dkorpel created dlang/dmd pull request #15817 "Fix 20332 - associative array
clear function should be @safe" fixing this issue:
- Fix 20332 - associative array clear function should be @safe
https://github.com/dlang/dmd/pull/15817
--
https://issues.dlang.org/show_bug.cgi?id=21675
--- Comment #1 from Paul Backus ---
This would also be fixed by having the compiler infer S.p as a @system variable
based on its initializer.
--
https://issues.dlang.org/show_bug.cgi?id=24225
Paul Backus changed:
What|Removed |Added
Keywords||safe
--
https://issues.dlang.org/show_bug.cgi?id=24225
Issue ID: 24225
Summary: @safe cast from base type to enum bypasses copy ctor,
identity opAssign
Product: D
Version: D2
Hardware: All
OS: All
Status
https://issues.dlang.org/show_bug.cgi?id=23780
--- Comment #2 from Paul Backus ---
Unfortunately this will probably be tricky to fix, because a lot of valid code
gets lowered to `obj.__ctor` internally by the DMD frontend.
--
https://issues.dlang.org/show_bug.cgi?id=24162
Nick Treleaven changed:
What|Removed |Added
CC||n...@geany.org
--- Comment #8 from Nick
our intention, like:
@safe:
import std.stdio: writeln;
void f(int x, ref int[] arr) {
arr[x] += 1;
arr ~= new int[90];
arr[x] += 1;
}
void main() {
auto arr = new int[10];
f(2, arr);
writeln(arr[0..10]);
}
--
, and you're allowed to
slice those arrays as much as you'd like. And as long as they're slices of
GC-allocated memory, it's all memory safe. So, trying to prevent mutable
aliasing when it comes to dynamic arrays is not going to work. For better or
worse, it's fundamental to how dynamic arrays work in D
https://issues.dlang.org/show_bug.cgi?id=24162
mhh changed:
What|Removed |Added
CC||maxha...@gmail.com
--- Comment #5 from mhh ---
This
ive.
> accessing this memory location no longer does what it was meant to do.
@safe is about preventing memory corruption, not bugs in general. The compiler
can't know what the intention of memory is, it just looks at size and lifetime.
Only if your reference becomes a dangling pointer or out of bounds in
https://issues.dlang.org/show_bug.cgi?id=24162
--- Comment #3 from Jonathan M Davis ---
There is nothing undefined about this. I suggest that you read this article:
https://dlang.org/articles/d-array-article.html
--
https://issues.dlang.org/show_bug.cgi?id=24162
--- Comment #2 from tomerfil...@gmail.com ---
suppose this function runs in a long living thread. so what you're saying is,
it will be leaked forever because the GC will see it's pointed by a stack
location? fine. but surely that's undefined
https://issues.dlang.org/show_bug.cgi?id=24162
Jonathan M Davis changed:
What|Removed |Added
CC||issues.dl...@jmdavisprog.co
https://issues.dlang.org/show_bug.cgi?id=24162
Issue ID: 24162
Summary: Another example of why @safe is broken
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority
https://issues.dlang.org/show_bug.cgi?id=20634
--- Comment #4 from Nick Treleaven ---
Note: The second commit was wrongly included in that pull and has been removed.
--
https://issues.dlang.org/show_bug.cgi?id=20634
--- Comment #3 from Dlang Bot ---
@ntrel updated dlang/dmd pull request #15572 "Fix Issue 24135 - Eponymous
template member overloads not shown as call candidates" fixing this issue:
- Fix Issue 20634 - @safe forces bounds checkin
https://issues.dlang.org/show_bug.cgi?id=23530
Nick Treleaven changed:
What|Removed |Added
Keywords||safe
CC
ualifier list) when applied to an lvalue.
The first rule was not enforced by dmd.
The second rule contradicts the point of the first rule. It should be
updated to work in the same way.
Fixes Issue 23530 - casting immutable away allowed in safe.
https://github.com/dlang/dmd/pull/15597
--
created dlang/dmd pull request #15581 "Allow using .ptr in @safe code
when pointer is safe to dereference" fixing this issue:
- Fix Issue 20634 - @safe forces bounds checking on newly allocated array when
using .ptr
Also allow for any string literal.
https://github.com/dlang/dmd/pull/15581
--
https://issues.dlang.org/show_bug.cgi?id=24098
--- Comment #2 from timon.g...@gmx.ch ---
I think the program is still at odds with the language specification even if
requirement 2 is not considered to be violated, because clearly it violates
requirement 1 and the preconditions hold (the
https://issues.dlang.org/show_bug.cgi?id=24098
--- Comment #1 from timon.g...@gmx.ch ---
Actually, depending on how exactly you interpret "create unsafe values", I
guess my `main` function may not violate requirement 2. However, I think this
is still a problem for memory safety in D and worth
https://issues.dlang.org/show_bug.cgi?id=24098
Issue ID: 24098
Summary: Safe variable can be initialized from `@system` static
constructor.
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
https://issues.dlang.org/show_bug.cgi?id=19916
Issue 19916 depends on issue 20655, which changed state.
Issue 20655 Summary: [REG: 2.072] attribute inference accepts unsafe union
access as @safe
https://issues.dlang.org/show_bug.cgi?id=20655
What|Removed
|--- |FIXED
--- Comment #9 from Dlang Bot ---
dlang/dmd pull request #14827 "fix issue 20655 - attribute inference accepts
unsafe union access as @safe" was merged into master:
- f55247d8c7fc3d7cf26dbbe34f03708515a5272b by Dennis Korpel:
Fix 20655 - attribute inference accepts un
On Wednesday, 2 August 2023 at 13:27:50 UTC, Steven Schveighoffer
wrote:
On 8/2/23 7:40 AM, Nick Treleaven wrote:
Presumably an allocation like `new T` (for a type with a @safe
constructor) can be made anywhere a call to `GC.collect` can
be made, which may trigger a collection. So why isn't
On 8/2/23 7:40 AM, Nick Treleaven wrote:
Presumably an allocation like `new T` (for a type with a @safe
constructor) can be made anywhere a call to `GC.collect` can be made,
which may trigger a collection. So why isn't `GC.collect` marked @safe?
It should be. Maybe historical reasons?
One
On Wednesday, 12 July 2023 at 09:47:26 UTC, Danilo wrote:
On Wednesday, 12 July 2023 at 05:27:27 UTC, mw wrote:
But what's wrong with my code? the strange compiler error?
Might be a bug/issue in the logger module.
`sharedLog` uses the `shared` attribute,
but the base class for everything
WebFreak said you can just use trace(), info() etc. inside
threads. It is thread-safe by default.
```d
module app;
import std.stdio;
import std.logger;
void main() {
//auto file = File("logFile.log", "w");
auto file = stderr; // stdout
sharedLog = cast(shared
On Wednesday, 12 July 2023 at 05:27:27 UTC, mw wrote:
But what's wrong with my code? the strange compiler error?
Might be a bug/issue in the logger module.
`sharedLog` uses the `shared` attribute,
but the base class for everything ("abstract class Logger")
does not use the `shared` attribute
1 - 100 of 4419 matches
Mail list logo