harmful null dereference straight in dmd

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Mar 7 08:49:00 PST 2009


Sean Kelly wrote:
> Andrei Alexandrescu wrote:
>> In what could be a supremely ironic turn, dmd has a null dereference 
>> error that leaves me in the dust. I have to compile a largish D2 app 
>> that last compiled in 2007. I was thinking all I have to do is fix the 
>> language and compiler changes, which is what I was doing, until a 
>> point where dmd unceremoniously aborts compilation with:
>>
>> Segmentation fault
>>
>> This looks like a null dereference, and is the fourth time I am seeing 
>> compilers errors that don't mention file and line. Rule #1 of compiler 
>> writing should be, whenever you fail for whatever reason, inform the 
>> user about where you were. Trying to do forensics without such vital 
>> information wastes hours like minutes.
>>
>> If there was a need to convince me that null dereference can be 
>> harmful, this situation drove the point home in a rather painful way.
> 
> That's nasty.  And it reminds me that I really need to try and figure 
> out if file/line info can be reported for a segfault.  Though I guess 
> the larger issue is whether D should have a non-null attribute :-)

Exactly. This event reminds me of a funny story that happened a couple 
of years ago. A radio talk show was discussing banning use of cell 
phones while driving. Some big wig politician calls the show and says, 
"I am driving right now and have no problem using my cell phone." Turns 
out the big wig subsequently did have an accident - that was heard on 
the show - ending that very dialog.

I can't find that story, newer stories are covering it in google.


Andrei



More information about the Digitalmars-d mailing list