Jump to page: 1 2
Thread overview
How to Fix Weird Build Failure with "-release" but OK with "-debug"?
Jul 21, 2021
apz28
Jul 21, 2021
Mathias LANG
Jul 21, 2021
apz28
Jul 21, 2021
apz28
Jul 21, 2021
Dukc
Jul 22, 2021
apz28
Jul 22, 2021
apz28
Jul 23, 2021
apz28
Jul 23, 2021
Ali Çehreli
Jul 21, 2021
bauss
July 21, 2021

VisualD project - Any hint to work around

DMD version:
DMD32 D Compiler v2.096.0-rc.1-dirty
Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved written by Walter Bright

Failed Build Command line:
dmd -release -m32mscoff -O -inline -dip25 -dip1000 -preview=fixAliasThis -X -Xf"Win32\Release\db_library.json" -c -of"Win32\Release\db_library.obj" @Win32\Release\db_library.build.rsp

with below error message:
....\pham\db\db_skdatabase.d(140): Error: null dereference in function _D4pham2db10fbdatabase7FbArray__T13readArrayImplTbZQsMFNfCQCeQCc8database12DbNameColumnZAb
....\pham\db\db_skdatabase.d(139): Error: null dereference in function _D4pham2db10fbdatabase7FbArray__T13readArrayImplTbZQsMFNfCQCeQCc8database12DbNameColumnZAb
Error: null dereference in function _D4pham2db10fbdatabase7FbArray__T13readArrayImplTbZQsMFNfCQCeQCc8database12DbNameColumnZAb
....\pham\db\db_skdatabase.d(138): Error: null dereference in function _D4pham2db10fbdatabase7FbArray__T13readArrayImplTbZQsMFNfCQCeQCc8database12DbNameColumnZAb

July 21, 2021

On Wednesday, 21 July 2021 at 03:25:03 UTC, apz28 wrote:

>

with below error message:
....\pham\db\db_skdatabase.d(140): Error: null dereference in function _D4pham2db10fbdatabase7FbArray__T13readArrayImplTbZQsMFNfCQCeQCc8database12DbNameColumnZAb
....\pham\db\db_skdatabase.d(139): Error: null dereference in function _D4pham2db10fbdatabase7FbArray__T13readArrayImplTbZQsMFNfCQCeQCc8database12DbNameColumnZAb
Error: null dereference in function _D4pham2db10fbdatabase7FbArray__T13readArrayImplTbZQsMFNfCQCeQCc8database12DbNameColumnZAb
....\pham\db\db_skdatabase.d(138): Error: null dereference in function _D4pham2db10fbdatabase7FbArray__T13readArrayImplTbZQsMFNfCQCeQCc8database12DbNameColumnZAb

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 ?

July 21, 2021

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;
    }
```
July 21, 2021

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

July 21, 2021

On Wednesday, 21 July 2021 at 03:25:03 UTC, apz28 wrote:

>

VisualD project - Any hint to work around

DMD version:
DMD32 D Compiler v2.096.0-rc.1-dirty
Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved written by Walter Bright

Failed Build Command line:
dmd -release -m32mscoff -O -inline -dip25 -dip1000 -preview=fixAliasThis -X -Xf"Win32\Release\db_library.json" -c -of"Win32\Release\db_library.obj" @Win32\Release\db_library.build.rsp

with below error message:
....\pham\db\db_skdatabase.d(140): Error: null dereference in function _D4pham2db10fbdatabase7FbArray__T13readArrayImplTbZQsMFNfCQCeQCc8database12DbNameColumnZAb
....\pham\db\db_skdatabase.d(139): Error: null dereference in function _D4pham2db10fbdatabase7FbArray__T13readArrayImplTbZQsMFNfCQCeQCc8database12DbNameColumnZAb
Error: null dereference in function _D4pham2db10fbdatabase7FbArray__T13readArrayImplTbZQsMFNfCQCeQCc8database12DbNameColumnZAb
....\pham\db\db_skdatabase.d(138): Error: null dereference in function _D4pham2db10fbdatabase7FbArray__T13readArrayImplTbZQsMFNfCQCeQCc8database12DbNameColumnZAb

The problem here is not actually -release but -O.

-O will check for null derefences in your code when using @safe I believe.

I didn't inspect your code much further, as I'm short on time right now, but you should have a starting point now at least.

July 21, 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 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

July 21, 2021

On Wednesday, 21 July 2021 at 14:15:51 UTC, Steven Schveighoffer wrote:

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

-Steve

DMD complains about dereferences in three different lines. I suspect it's this reference that is null.

July 22, 2021

On Wednesday, 21 July 2021 at 20:39:54 UTC, Dukc wrote:

>

On Wednesday, 21 July 2021 at 14:15:51 UTC, Steven Schveighoffer wrote:

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

-Steve

DMD complains about dereferences in three different lines. I suspect it's this reference that is null.

Look like DMD has some bug. If I changed this line https://github.com/apz28/dlang/blob/02989b94bfe306d723f2780e010c61f71f873cbe/source/pham/db/db_fbdatabase.d#L148

from: auto reader = FbXdrReader(null, response.data);
to: auto reader = FbXdrReader(fbConnection, response.data);

then the error go away. FbXdrReader constructor allows to accept null for that parameter. Is it "safe" means not allow to pass null?

July 22, 2021

On 7/22/21 2:38 PM, apz28 wrote:

>

On Wednesday, 21 July 2021 at 20:39:54 UTC, Dukc wrote:

>

On Wednesday, 21 July 2021 at 14:15:51 UTC, Steven Schveighoffer wrote:

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

DMD complains about dereferences in three different lines. I suspect it's this reference that is null.

Look like DMD has some bug. If I changed this line https://github.com/apz28/dlang/blob/02989b94bfe306d723f2780e010c61f71f873cbe/source/pham/db/db_fbdatabase.d#L148

from: auto reader = FbXdrReader(null, response.data);
to: auto reader = FbXdrReader(fbConnection, response.data);

then the error go away. FbXdrReader constructor allows to accept null for that parameter. Is it "safe" means not allow to pass null?

I don't know what an FbConnection is, but it looks like you call something on it. Your code is immense, and github search really really sucks. So I can't get better information. But if it's a class, and that is a normal member, it is indeed dereferencing a null pointer.

-Steve

July 22, 2021

On Thursday, 22 July 2021 at 18:56:43 UTC, Steven Schveighoffer wrote:

>

On 7/22/21 2:38 PM, apz28 wrote:

>

On Wednesday, 21 July 2021 at 20:39:54 UTC, Dukc wrote:

>

On Wednesday, 21 July 2021 at 14:15:51 UTC, Steven Schveighoffer wrote:

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

DMD complains about dereferences in three different lines. I suspect it's this reference that is null.

Look like DMD has some bug. If I changed this line https://github.com/apz28/dlang/blob/02989b94bfe306d723f2780e010c61f71f873cbe/source/pham/db/db_fbdatabase.d#L148

from: auto reader = FbXdrReader(null, response.data);
to: auto reader = FbXdrReader(fbConnection, response.data);

then the error go away. FbXdrReader constructor allows to accept null for that parameter. Is it "safe" means not allow to pass null?

I don't know what an FbConnection is, but it looks like you call something on it. Your code is immense, and github search really really sucks. So I can't get better information. But if it's a class, and that is a normal member, it is indeed dereferencing a null pointer.

-Steve

FbConnection is a class, FbXdrReader is a struct and for this call, response.data is not null & its' length will be greater than zero and FbConnection is not being used. So why DMD try to evaluate at compiled time hence error

  1. Should not evaluate at compile time for this function call/construct
  2. The error message is missing proper line # or nothing related to the module displayed in error message

https://github.com/apz28/dlang/blob/main/source/pham/db/db_fbbuffer.d#L527

« First   ‹ Prev
1 2