How to Fix Weird Build Failure with "-release" but OK with "-debug"?

Steven Schveighoffer schveiguy at gmail.com
Wed Jul 21 14:15:51 UTC 2021


On 7/21/21 7:56 AM, apz28 wrote:
> On Wednesday, 21 July 2021 at 11:52:39 UTC, apz28 wrote:
>> On Wednesday, 21 July 2021 at 04:52:44 UTC, Mathias LANG wrote:
>>
>>>
>>> It seems the compiler is doing extra analysis and seeing that a null 
>>> pointer is being dereferenced. Can you provide the code for 
>>> "pham\db\db_skdatabase.d" at L138 through 140 ?
>>
>>     ```d
>>     package(pham.db):  // Line# 133
>>         final DbReadBuffer acquireSocketReadBuffer(size_t capacity = 
>> DbDefaultSize.socketReadBufferLength) nothrow @safe
>>         {
>>             version (TraceFunction) dgFunctionTrace();
>>
>>             if (_socketReadBuffer is null)
>>                 _socketReadBuffer = createSocketReadBuffer(capacity);
>>             return _socketReadBuffer;
>>         }
>>     ```
> 
> The entire codes is available from github
> https://github.com/apz28/dlang/blob/main/source/pham/db/db_skdatabase.d#L138 
> 

1. That filename is totally wrong, or the function name is totally 
wrong. ddemangle says the function is `@safe bool[] 
pham.db.fbdatabase.FbArray.readArrayImpl!(bool).readArrayImpl(pham.db.database.DbNameColumn)` 
which seems to be located 
[here](https://github.com/apz28/dlang/blob/02989b94bfe306d723f2780e010c61f71f873cbe/source/pham/db/db_fbdatabase.d#L142) 
But the line numbers also don't match. maybe an inlining issue?

2. It's hard for me to see where the null dereference would be in that 
function (the `bool` implementation is pretty simple).

-Steve


More information about the Digitalmars-d-learn mailing list