[Issue 24867] Wrong deprecation warning of @system variable usage under CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 19 18:54:50 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24867

--- Comment #5 from Luís Ferreira <contact at lsferreira.net> ---
> It needs to be stressed that the deprecation comes from the **outer** `align(1)`, which is IMO a total anti-pattern anyway.

It's clear to me that blindly doing align(1) everywhere is an anti-pattern, but
its not an always bad situation, there's places you really need to do this,
e.g. implementing a protocol, dealing with raw data emplacement, etc. And I'm
pretty sure you are well aware of those use-cases. 

Btw, we use it a lot, in traces protocol and probably also on the filesystem
code, which, neither of those are ever tracked by the GC.

Therefore, it doesn't mean it shouldn't be supported. Anyway, I guess I don't
have to explain it, but did it anyway.

> Do you consider this a bug as well, because in the current AST-interpreter CTFE implementation, unions don't actually overlap?

I think we should clarify the union situation and possibly make that specific
case implementation defined, because someone might implement it with target
machine code, like I said with JIT, although, I wouldn't recommend trusting a
compiler that does JIT by escaping the safety semantics and therefore the
sandbox that is CTFE, not only because of unpredictable output by relying on
impure/poisoned state but also security-wise.

But I think **IT IS** definitely a bug for the case where it's guaranteed to be
initialised as `.rodata`, regardless of being "misaligned" in the context of GC
or not. I can't think of a way to be unsafe here. Also, the compiler can
already easily check for this information.

--


More information about the Digitalmars-d-bugs mailing list