godot: Segfaults in release (opt) template built with GCC 6
Compiling Godot for release gives consistent SIGSEGV
signal when running some of the demos. It seems to be related to the resource loader based on what I get from backtraces.
This is what I get in master with the GUI drag and drop demo (I get an identical BT in other GUI demos, such as input mapping and translation):
(gdb) where
#0 0x0000000000594937 in DVector<String>::resize(int) ()
#1 0x00000000011fdd8c in ResourceInteractiveLoaderBinary::parse_variant(Variant&) ()
#2 0x00000000011fc669 in ResourceInteractiveLoaderBinary::parse_variant(Variant&) ()
#3 0x00000000011ff94b in ResourceInteractiveLoaderBinary::poll() ()
#4 0x000000000122692a in ResourceFormatLoader::load(String const&, String const&, Error*)
()
#5 0x00000000012260b9 in ResourceLoader::load(String const&, String const&, bool, Error*)
()
#6 0x0000000000429ff3 in Main::start() ()
#7 0x000000000040d0ed in main ()
I went as far as 37af8b4 and still get the same thing, even with a clean build. At that point, the 2d platformer also raises a similar error:
(gdb) where
#0 0x00000000005cdeea in DVector<String>::resize(int) ()
#1 0x000000000109eac9 in ResourceInteractiveLoaderXML::parse_property(Variant&, String&)
()
#2 0x000000000109d17c in ResourceInteractiveLoaderXML::parse_property(Variant&, String&)
()
#3 0x00000000010a3de7 in ResourceInteractiveLoaderXML::poll() ()
#4 0x00000000010f546a in ResourceFormatLoader::load(String const&, String const&) ()
#5 0x00000000010f4c95 in ResourceLoader::load(String const&, String const&, bool) ()
#6 0x000000000046f70b in GDParser::_parse_expression(GDParser::Node*, bool, bool) ()
#7 0x00000000004719c7 in GDParser::_parse_and_reduce_expression(GDParser::Node*, bool, bool, bool) ()
#8 0x00000000004741f0 in GDParser::_parse_class(GDParser::ClassNode*) ()
#9 0x0000000000476438 in GDParser::_parse(String const&) ()
#10 0x0000000000476767 in GDParser::parse(String const&, String const&, bool, String const&) ()
#11 0x000000000042191e in GDScript::reload() ()
#12 0x0000000000433e07 in ResourceFormatLoaderGDScript::load(String const&, String const&)
()
#13 0x00000000010f4c95 in ResourceLoader::load(String const&, String const&, bool) ()
#14 0x000000000046f70b in GDParser::_parse_expression(GDParser::Node*, bool, bool) ()
#15 0x000000000046eabd in GDParser::_parse_expression(GDParser::Node*, bool, bool) ()
#16 0x00000000004719c7 in GDParser::_parse_and_reduce_expression(GDParser::Node*, bool, bool, bool) ()
#17 0x0000000000472230 in GDParser::_parse_block(GDParser::BlockNode*, bool) ()
#18 0x0000000000473ff9 in GDParser::_parse_class(GDParser::ClassNode*) ()
#19 0x0000000000476438 in GDParser::_parse(String const&) ()
#20 0x0000000000476767 in GDParser::parse(String const&, String const&, bool, String const&) ()
#21 0x000000000042191e in GDScript::reload() ()
#22 0x0000000000433e07 in ResourceFormatLoaderGDScript::load(String const&, String const&)
()
#23 0x00000000010f4c95 in ResourceLoader::load(String const&, String const&, bool) ()
#24 0x00000000010a3f56 in ResourceInteractiveLoaderXML::poll() ()
#25 0x00000000010f546a in ResourceFormatLoader::load(String const&, String const&) ()
#26 0x00000000010f4c95 in ResourceLoader::load(String const&, String const&, bool) ()
#27 0x00000000010a3f56 in ResourceInteractiveLoaderXML::poll() ()
#28 0x00000000010f546a in ResourceFormatLoader::load(String const&, String const&) ()
#29 0x00000000010f4c95 in ResourceLoader::load(String const&, String const&, bool) ()
#30 0x000000000041ae8a in Main::start() ()
#31 0x000000000040ea2d in main ()
Is DVector<T>::resize()
the culprit?
Also, the 2D platformer does not have such problem in current master, but it was updated to the new .tscn
format, which may have mitigated the problem. So I guess this can be some compatibility breakage introduced somewhere, so old binary scenes don’t load right. It certainly can be something else.
And I hope somebody else can reproduce this issue or I may have to burn my computer 👿
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 39 (39 by maintainers)
Well, I did quick analysis.
replace env.Append(CCFLAGS=[‘-O3’,‘-ffast-math’]) with env.Append(CCFLAGS=[‘-O2’,‘-ffast-math’]) env.Append(CCFLAGS=[‘-fgcse-after-reload’, ‘-finline-functions’, ‘-fipa-cp-clone’, ‘-fpredictive-commoning’, ‘-fsplit-paths’, ‘-ftree-loop-distribute-patterns’, ‘-ftree-loop-vectorize’])
Or use env.Append(CCFLAGS=[‘-O3’,‘-ffast-math’, ‘-fno-vect-cost-model’]) And no problem occurs. The above is safer and gives more control the culprit is -fvect-cost-model=dynamic gcc option which is added by gcc -O3.
The reason is probably alignment issues which are triggered (trapped) by vectorized code. Somebody should try building Godot with -fsanitize=undefined and see the traps.
The removal of -fvect-cost-model=dynamic just hides an issue, not fixing it, so consider it a workaround.
On Fri, May 13, 2016 at 8:32 PM, Sergey Lapin slapinid@gmail.com wrote: @
While testing some 2.1 PR got some kind of random crashes with
as the last message, using GCC 6.
I have not experienced that with master when I tried a while ago, now got some errors when trying to compile release_debug.