www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11975] New: DMD64 D Compiler v2.065-devel-3b37a57 crashes for simple inheritance

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11975

           Summary: DMD64 D Compiler v2.065-devel-3b37a57 crashes for
                    simple inheritance
           Product: D
           Version: unspecified
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: sumit.adhikari gmail.com


--- Comment #0 from Sumit Adhikari <sumit.adhikari gmail.com> 2014-01-22
22:04:36 PST ---
Following code leads to segmentation fault:


abstract class foo_base(T) 
{
   private T    bro ; 

   public void zoo(T bro_) {
      bro = bro_ ;
   }

}

class foo(T) : foo_base!(T) 
{

}

void main() 
{

   foo!double  Foo ;
   Foo.zoo(1.0); 

}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 22 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11975


Sumit Adhikari <sumit.adhikari gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sumit.adhikari gmail.com


--- Comment #1 from Sumit Adhikari <sumit.adhikari gmail.com> 2014-01-22
22:05:54 PST ---
This is a blocker for current development. Please take a look at it as soon as
possible.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 22 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11975



--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2014-01-22 22:38:37 PST ---
(In reply to comment #0)
 Following code leads to segmentation fault:
 
 void main() 
 {
 
    foo!double  Foo ;
    Foo.zoo(1.0); 
 
 }

You're call instance method 'zoo' on null object reference. void main() { foo!double Foo; assert(Foo is null); // ! Foo.zoo(1.0); // Segfault } To me the segfault looks intended result. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 22 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11975



--- Comment #3 from Sumit Adhikari <sumit.adhikari gmail.com> 2014-01-22
22:51:05 PST ---
Why is the compiler not able to tell me the problem and I need to go through a
segfault ?

Regards, Sumit

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 22 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11975


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com
           Platform|x86_64                      |All
            Version|unspecified                 |D2
            Summary|DMD64 D Compiler            |Compile time error on null
                   |v2.065-devel-3b37a57        |dereference
                   |crashes for simple          |
                   |inheritance                 |
         OS/Version|Linux                       |All
           Severity|blocker                     |enhancement


--- Comment #4 from yebblies <yebblies gmail.com> 2014-01-23 18:18:50 EST ---
(In reply to comment #3)
 Why is the compiler not able to tell me the problem and I need to go through a
 segfault ?
 
 Regards, Sumit

The analysis to detect this has not been implemented, and there is some question as to whether it is worth implementing given how easy it is to identify the source of the segfault in a debugger. It will actually detect this simple case if you compile with -O. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 22 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11975


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw ubuntu.com


--- Comment #5 from Iain Buclaw <ibuclaw ubuntu.com> 2014-01-23 00:10:24 PST ---
(In reply to comment #0)
 Following code leads to segmentation fault:
 
 
 abstract class foo_base(T) 

It looks like your treating a class as if it is equivalent to C++? An error on null dereference is a bit of a problem as it could potential be more breaking than good. Not to mention all the cases that we can't catch. --- shared MyClass foo; /* 'foo' gets initialised by another thread in the meantime... Or at least so we expect. :) */ foo.bar(); // BOOM! -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 23 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11975


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |DUPLICATE


--- Comment #6 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2014-01-23
08:13:19 PST ---
*** This issue has been marked as a duplicate of issue 4595 ***

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 23 2014