Menu

#13 Building torcs-1.3.6 with GCC-7 fails

None
closed
nobody
None
1
2026-04-13
2018-03-31
Hodorgasm
No

GCC-7 forbids implicit conversion from bool or char to pointer. As such, building torcs-1.3.6 fails with:

OpenALMusicPlayer.cpp: In member function virtual bool OpenALMusicPlayer::streamBuffer(ALuint):
OpenALMusicPlayer.cpp:164:22: error: invalid conversion from char to const char* [-fpermissive]
  const char* error = '\0';
                      ^~~~

The offending line is:

const char* error = '\0';`

Debian already patches this here using nullptr, an inappropriate construct if building in c++98 mode.

Furthermore, examining the context of use:

GfError("OpenALMusicPlayer: Stream read error: %s\n", error);

Since GfError is a macro for printf and since passing a NULL char pointer to a printf %s placeholder is undefined behavior, error should ideally be implemented as a real pointer pointing to an empty cstring.

1 Attachments

Discussion

  • Hodorgasm

    Hodorgasm - 2018-03-31
    • Attachments has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +0,0 @@
    -torcs-1.3.6-gcc7.patch (365 Bytes; text/x-patch)
    
     
  • Hodorgasm

    Hodorgasm - 2018-03-31
    • Attachments has changed:

    Diff:

    --- old
    +++ new
    @@ -0,0 +1 @@
    +torcs-1.3.6-gcc7.patch (338 Bytes; text/x-patch)
    
    • Group: -->
     
  • Bernhard Wymann

    Bernhard Wymann - 2026-04-13
    • status: open --> closed
     

Log in to post a comment.