[sword-devel] Segmentation fault - was Re: SWORD 1.7.0RC3

Troy A. Griffitts scribe at crosswire.org
Wed Sep 11 09:56:23 MST 2013


Jaak, I disagree that your comments have anything to do with this problem. I have confirmed that the 3 file globals immediately preceding the problem global have been initialized. I doubt you are saying the c++ standard doesn't support initializing a global array and then initializing a global std::list with the members of this array, all in the same object file. I know the spec doesn't assure global initialization order across object files, but within the same object file, I find it hard to believe there is no specification to the order.

Jaak Ristioja <jaak at ristioja.ee> wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>It's not a compiler bug.
>
>Basically the C++ standard does not enforce an initialization order
>for globals. So the compiler is free to initialize such stuff in any
>order. I think your toolchain just happens to be lucky enough to do
>that in an the order which doesn't yield in a crash.
>
>I don't have the time to look this up in the C++ standards myself, but
>you can google such stuff:
>
>http://stackoverflow.com/questions/3746238/c-global-initialization-order-ignores-dependencies
>
>
>Blessings,
>Jaak
>
>On 10.09.2013 18:12, Troy A. Griffitts wrote:
>> Hey Jaak,
>> 
>> Thank, yeah, but why?  :)
>> 
>> My investigation turns up:
>> 
>> shared build works fine and valgrinds clean static build on g++
>> (GCC) 4.8.1 (F19) fails static build on g++ (GCC) 4.4.7 (RHEL 6.4)
>> works fine and valgrinds clean
>> 
>> In the error case, it seems that std::list's c-tor(iterator start, 
>> iterator end) doesn't get called appropriately, though all the
>> other file globals get initialized just fine.
>> 
>> I moved the global filter in the utility to a stack variable and
>> it alleviates the problem, but still wonder why the problem in the
>> first place.
>> 
>> Any advice would be appreciated.  If I'm doing something wrong, I'd
>> like to change it, but right now I'm going with "compiler bug" :)
>> 
>> Troy
>> 
>> 
>> 
>> 
>> 
>> On 09/10/2013 08:20 AM, Jaak Ristioja wrote: I'm pretty sure that
>> the crash is because the global
>> 
>> const StringList oValues(&choices[0], &choices[2]);
>> 
>> in ../src/modules/filters/utf8greekaccents.cpp:41 is not
>> initialized when it is used in UTF8GreekAccents::UTF8GreekAccents()
>> to initialize the global
>> 
>> UTF8GreekAccents greekAccentsFilter;
>> 
>> instance in imp2gbs.cpp:62.
>> 
>> 
>> Blessings, Jaak
>> 
>> On 10.09.2013 02:02, Peter von Kaehne wrote:
>>>>> I hate to bring this up, now, when we really all want 1.7
>>>>> out, but current svn head produces a segmentation fault in
>>>>> imp2gbs. The other utilities insofar as I tested them seem to
>>>>> be fine.
>>>>> 
>>>>> Below the stacktrace. Tell me if you need more. I basically
>>>>> use usrinst.sh produced binaries, with the only modification
>>>>> that I changed the install directory to /usr/local/bin
>>>>> 
>>>>> 
>>>>> 
>>>>> peter at peter-ThinkPad-Twist:~/Source/sword$ gdb 
>>>>> /usr/local/bin/imp2gbs GNU gdb (GDB) 7.5-ubuntu Copyright (C)
>>>>> 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL
>>>>> version 3 or later <http://gnu.org/licenses/gpl.html> This is
>>>>> free software: you are free to change and redistribute it.
>>>>> There is NO WARRANTY, to the extent permitted by law.  Type
>>>>> "show copying" and "show warranty" for details. This GDB was
>>>>> configured as "i686-linux-gnu". For bug reporting
>>>>> instructions, please see: 
>>>>> <http://www.gnu.org/software/gdb/bugs/>... Reading symbols
>>>>> from /usr/local/bin/imp2gbs...done. (gdb) r Starting
>>>>> program: /usr/local/bin/imp2gbs
>>>>> 
>>>>> Program received signal SIGSEGV, Segmentation fault.
>>>>> 0x08050b7a in sword::SWBuf::c_str (this=0x8) at
>>>>> ../include/swbuf.h:141 141 inline const char *c_str() const{
>>>>> return buf; } (gdb) bt #0 0x08050b7a in sword::SWBuf::c_str
>>>>> (this=0x8) at ../include/swbuf.h:141 #1  0x0805a790 in 
>>>>> sword::SWOptionFilter::setOptionValue (this=0x8115b60 
>>>>> <greekAccentsFilter>, ival=0x80c715b "On") at 
>>>>> ../src/modules/filters/swoptfilter.cpp:51 #2  0x0805aca2 in 
>>>>> sword::UTF8GreekAccents::UTF8GreekAccents (this=0x8115b60 
>>>>> <greekAccentsFilter>, __in_chrg=<optimised out>, 
>>>>> __vtt_parm=<optimised out>) at 
>>>>> ../src/modules/filters/utf8greekaccents.cpp:43 #3  0x0805099d
>>>>> in __static_initialization_and_destruction_0
>>>>> (__initialize_p=1, __priority=65535) at imp2gbs.cpp:62 #4
>>>>> 0x080509df in _GLOBAL__sub_I_imp2gbs.cpp(void) () at
>>>>> imp2gbs.cpp:273 #5 0x080c6ae2 in __libc_csu_init () #6
>>>>> 0xb77f046a in __libc_start_main () from
>>>>> /lib/i386-linux-gnu/libc.so.6 #7 0x0804f931 in _start ()
>>>>> (gdb) #0  0x08050b7a in sword::SWBuf::c_str (this=0x8) at
>>>>> ../include/swbuf.h:141 #1  0x0805a790 in 
>>>>> sword::SWOptionFilter::setOptionValue (this=0x8115b60 
>>>>> <greekAccentsFilter>, ival=0x80c715b "On") at 
>>>>> ../src/modules/filters/swoptfilter.cpp:51 #2  0x0805aca2 in 
>>>>> sword::UTF8GreekAccents::UTF8GreekAccents (this=0x8115b60 
>>>>> <greekAccentsFilter>, __in_chrg=<optimised out>, 
>>>>> __vtt_parm=<optimised out>) at 
>>>>> ../src/modules/filters/utf8greekaccents.cpp:43 #3  0x0805099d
>>>>> in __static_initialization_and_destruction_0
>>>>> (__initialize_p=1, __priority=65535) at imp2gbs.cpp:62 #4
>>>>> 0x080509df in _GLOBAL__sub_I_imp2gbs.cpp(void) () at
>>>>> imp2gbs.cpp:273 #5 0x080c6ae2 in __libc_csu_init () #6
>>>>> 0xb77f046a in __libc_start_main () from
>>>>> /lib/i386-linux-gnu/libc.so.6 #7 0x0804f931 in _start ()
>>>>> (gdb) #0  0x08050b7a in sword::SWBuf::c_str (this=0x8) at
>>>>> ../include/swbuf.h:141 #1  0x0805a790 in 
>>>>> sword::SWOptionFilter::setOptionValue (this=0x8115b60 
>>>>> <greekAccentsFilter>, ival=0x80c715b "On") at 
>>>>> ../src/modules/filters/swoptfilter.cpp:51 #2  0x0805aca2 in 
>>>>> sword::UTF8GreekAccents::UTF8GreekAccents (this=0x8115b60 
>>>>> <greekAccentsFilter>, __in_chrg=<optimised out>, 
>>>>> __vtt_parm=<optimised out>) at 
>>>>> ../src/modules/filters/utf8greekaccents.cpp:43 #3  0x0805099d
>>>>> in __static_initialization_and_destruction_0
>>>>> (__initialize_p=1, __priority=65535) at imp2gbs.cpp:62 #4
>>>>> 0x080509df in _GLOBAL__sub_I_imp2gbs.cpp(void) () at
>>>>> imp2gbs.cpp:273 #5 0x080c6ae2 in __libc_csu_init () #6
>>>>> 0xb77f046a in __libc_start_main () from
>>>>> /lib/i386-linux-gnu/libc.so.6 #7 0x0804f931 in _start ()
>>>>> (gdb)
>>>>> 
>>>>> 
>>>>> 
>>>>> _______________________________________________ sword-devel
>>>>> mailing list: sword-devel at crosswire.org 
>>>>> http://www.crosswire.org/mailman/listinfo/sword-devel
>>>>> Instructions to unsubscribe/change your settings at above
>>>>> page
>>>>> 
>>> 
>>> _______________________________________________ sword-devel
>>> mailing list: sword-devel at crosswire.org 
>>> http://www.crosswire.org/mailman/listinfo/sword-devel 
>>> Instructions to unsubscribe/change your settings at above page
>> 
>> 
>> _______________________________________________ sword-devel mailing
>> list: sword-devel at crosswire.org 
>> http://www.crosswire.org/mailman/listinfo/sword-devel Instructions
>> to unsubscribe/change your settings at above page
>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v2.0.20 (GNU/Linux)
>
>iQgcBAEBAgAGBQJSMHp7AAoJEEqsYmEt1rCOblpAAIfO/ypou3k0iGOmyo6xOay1
>zGDLP0d8zgGJ4qIT48nsFTEgrSdLukeIhl1QO4hhCevw4IY/r7+pH1gQYlqrhquP
>9esPk3SwUWn6oKVHD/7FTbDhap1EFtbsqyu273xV/08m9j/UROOSQAlWYPYmcsn1
>5WLocCLrQO+RPNV0x2WuHkNXjm9R9ktqGrBDIQuCPArZehY6SVU5nsf+KdFMaNek
>b1Esu+K8Qnyua77SI79K9Aj0s4HsSewrOYCe3TdiBqOKY9lJyHSdAuF3GiEIN2XZ
>r/vegWmPRSuOXhLqFGXg5WDuGZcPCeeOCZy7AU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kWDcrUQpZS71LMM7Wx0LJfolDOh6EhdIg37dtxgw8+St
>GhuGtHv0gRl+d/HS2tnwCej8rgO/8KA7Y8g9XYVA8iPmJH8qvImisioTOQsJm9mX
>3qFzLbZrP/bPRpckGwACbwuYs1xBCyu7i2Fl/9ec3xX7lEvZkoT9vG0Vv4vMSgwW
>ThhOFc4y5KKUfKdik8u25j72+Bv4Rp/NuqqeC/P11JfEVzWn30x8gSrFiqcORlQ6
>waGNah30EatCy2ZZOUEqfH2MCb70AsIZSfmPjsRrtmB4MNuLcZaDOuXiey2XS3b/
>swjcbbC0bQSas+7uOfqc
>=I09B
>-----END PGP SIGNATURE-----
>
>_______________________________________________
>sword-devel mailing list: sword-devel at crosswire.org
>http://www.crosswire.org/mailman/listinfo/sword-devel
>Instructions to unsubscribe/change your settings at above page

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20130911/0ac5a0e5/attachment.html>


More information about the sword-devel mailing list