LDC 1.33.0-beta2

Johan j at j.nl
Tue Jul 11 21:30:49 UTC 2023


On Sunday, 11 June 2023 at 02:06:31 UTC, kinke wrote:
> Glad to announce the second beta for LDC 1.33. Major changes 
> since beta1:
>
> - New CLI option `-femit-local-var-lifetime` to enable stack 
> memory reuse.

For people testing this release, please enable this flag on your 
projects.

It is disabled by default because it enables aggressive 
optimizations which may uncover latent bugs in your code: use of 
variable after its scope has ended. An example:

```
void useAfterScope() {
   int* p;
   {
     int x = 0;
     p = &x;  // cannot statically disallow this because
     *p = 1;  // this is a valid use of things
   }
   *p = 5;  // but when you do this... stack use after scope bug!
}
```
Use of AddressSanitizer with `-femit-local-var-lifetime` would 
catch this bug.

cheers,
   Johan



More information about the Digitalmars-d-announce mailing list