Project

General

Profile

Bug #2249

segfault Arch Linux GCC7

Added by fauxmight over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Regression
Target version:
Start date:
2017-06-16
% Done:

100%

Tags:
GCC

Description

I've compiled the 2.0.1 release and the current git master. Both segfault IF COMPILED WITH -O2.
I can avoid the segfault by compiling with -O0, but this is obviously not an ideal solution.

I've attached gdb output including a backtrace of the segfaulting 2.0.1 build.
This appears to be a similar issue to the one noted in these (separate) projects:
https://github.com/godotengine/godot/issues/4673
https://github.com/godotengine/godot/issues/4588

I believe this is a cast_to a NULL object in doomsday/sdk/libcore/include/de/filesys/node.h ,
but I have not managed to track it down.
Please let me know if I can offer any more helpful information.

doomsday-gdb.txt (15.6 KB) doomsday-gdb.txt gdb backtace on doomsday segfault fauxmight, 2017-06-16 07:01

Associated revisions

Revision 5f9c5638 (diff)
Added by skyjake over 7 years ago

Fixed|Refactor: Potential crash in release build

According to the C++ standard, compilers are allowed to assume that
the `this` pointer is never null. This may allow them to optimize
certain operations better. However, the libcore.h AS_IS methods were
not compatible with this assumption (and the C++ standard), so they
were replaced with de::maybeAs<> template methods.

As a bonus, classes using these cast macros have fewer methods since
only the as<> methods remain in the class.

IssueID #2249

Revision e2d37024 (diff)
Added by skyjake over 7 years ago

Fixed|Refactor: Potential crash in release build

According to the C++ standard, compilers are allowed to assume that
the `this` pointer is never null. This may allow them to optimize
certain operations better. However, the libcore.h AS_IS methods were
not compatible with this assumption (and the C++ standard), so they
were replaced with de::maybeAs<> template methods.

As a bonus, classes using these cast macros have fewer methods since
only the as<> methods remain in the class.

IssueID #2249

History

#1 Updated by skyjake over 7 years ago

  • Tags set to GCC
  • Status changed from New to In Progress
  • Assignee set to skyjake
  • Target version set to 2.0.2

The godot discussion hints at a possible workaround, I'll give it a try.

#2 Updated by fauxmight over 7 years ago

I'm sure this is obvious to you as the developer, but it appears the casts creating issues are probably those in the DENG2_AS_IS_METHODS() section of doomsday/sdk/libcore/include/de/libcore.h if I'm reading the code correctly.

#3 Updated by skyjake over 7 years ago

  • % Done changed from 0 to 100

5f9c563853 seems to fix it for me when compiling with GCC 7.1.1 (on Fedora). I can include this fix in the stable branch as well after it's clear nothing has been broken.

#4 Updated by fauxmight over 7 years ago

This fix is great on Arch as well. Can close this issue as far as I'm concerned. Many thanks.

#5 Updated by skyjake over 7 years ago

  • Status changed from In Progress to Closed

Also available in: Atom PDF