Thread overview
[Issue 13970] Simple flow analysis should eliminate null uses statically
Jan 12, 2015
Adam D. Ruppe
Dec 17, 2022
Iain Buclaw
January 12, 2015
https://issues.dlang.org/show_bug.cgi?id=13970

bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc

--- Comment #1 from bearophile_hugs@eml.cc ---
I suggest to not put in Bugzilla links to code located elsewhere, because it can vanish. The example:

import std.stdio;
import std.typecons;
class Foo(T){
public:
  T i;
}
class Bar{
public:
  int hello = 0;
}

void main()
{
  Foo!(Bar) f;
  int i = f.i.hello;
}

--
January 12, 2015
https://issues.dlang.org/show_bug.cgi?id=13970

Adam D. Ruppe <destructionator@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |destructionator@gmail.com

--- Comment #2 from Adam D. Ruppe <destructionator@gmail.com> ---
I believe this is done in dmd -O builds already

void main() {
    Object o;
    o.toString();
}

$ dmd n -O n.d(3): Error: null dereference in function _Dmain

So the backend already does it, maybe the frontend can borrow that too.

--
January 12, 2015
https://issues.dlang.org/show_bug.cgi?id=13970

--- Comment #3 from Andrei Alexandrescu <andrei@erdani.com> ---
@Adam Discussions with Walter suggest the mechanism used by the optimizer is unsuitable here.

The closest thing we have is the analysis that makes sure super() is called exactly once in derived constructors. That is well understood, covers a bunch of cases, and IIRC is used in Java as well. So using the same analysis for this purpose seem fit.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=13970

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
December 13
https://issues.dlang.org/show_bug.cgi?id=13970

--- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18927

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--