You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
0.66 fails to build from source (autotests fail) on several architectures #1428
...
555/798 Test #557: cpp_33057 ........................***Failed 0.10 sec
Files "/<<BUILDDIR>>/uncrustify-0.66+dfsg1/tests/results/cpp/33057-bug_1349.cpp" to "/<<BUILDDIR>>/uncrustify-0.66+dfsg1/tests/output/cpp/33057-bug_1349.cpp" are different.
CMake Error at /<<BUILDDIR>>/uncrustify-0.66+dfsg1/tests/run_test.cmake:54 (message):
MISSMATCH: results/cpp/33057-bug_1349.cpp does not match
output/cpp/33057-bug_1349.cpp
...
The following tests FAILED:
557 - cpp_33057 (Failed)
Errors while running CTest
Makefile:142: recipe for target 'test' failed
make[1]: *** [test] Error 8
I'll try to check the problem as soon as I have free time, but you are welcome to do the analysis yourself (at least on i386).
Program received signal SIGSEGV, Segmentation fault.
0x00005555555b255a in std::char_traits<char>::length (__s=0x170 <error: Cannot access memory at address 0x170>) at /usr/include/c++/6/bits/char_traits.h:267
267 { return __builtin_strlen(__s); }
(gdb) where
#0 0x00005555555b255a in std::char_traits<char>::length (__s=0x170 <error: Cannot access memory at address 0x170>) at /usr/include/c++/6/bits/char_traits.h:267
#1 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string (__a=..., __s=0x170 <error: Cannot access memory at address 0x170>, this=0x7fffffffc420)
at /usr/include/c++/6/bits/basic_string.h:456
#2 op_val_to_string[abi:cxx11](argtype_e, op_val_t) (argtype=AT_STRING, op_val=...)
at ./src/options.cpp:2782
#3 0x00005555555b2979 in save_option_file_kernel (pfile=pfile@entry=0x5555558f7130, withDoc=withDoc@entry=false, only_not_default=only_not_default@entry=true)
at ./src/options.cpp:2295
#4 0x00005555555b46a7 in output_parsed (pfile=0x5555558f7130) at ./src/output.cpp:410
#5 0x00005555555dd740 in uncrustify_file (fm=..., pfout=0x555555883a40, parsed_file=0x7fffffffe26b "/tmp/33057-bug_1349.cpp.unc", defer_uncrustify_end=<optimized out>)
at ./src/uncrustify.cpp:1941
#6 0x00005555555de52b in do_source_file (filename_in=0x7fffffffe240 "bug_1349.cpp", filename_out=<optimized out>, parsed_file=0x7fffffffe26b "/tmp/33057-bug_1349.cpp.unc",
no_backup=<optimized out>, keep_mtime=<optimized out>) at ./src/uncrustify.cpp:1326
#7 0x00005555555df7a9 in main (argc=<optimized out>, argv=<optimized out>)
at ./src/uncrustify.cpp:780
Only the number_to_string function in op_val_to_string is slightly sketchy, that is going to be replaced by std::to_string soon.
Ohh maybe it is accessing the union in a wrong way
-p has to be used to enter the output_parsed function
note that this happens on the 33057-bug_1349.cpp.unc file, I think this happens on the rerun test step
the tests don't use the -p flag ... @gerasiov: did you use the -p flag here? If so this might be an entirely different bug.
I modified the check_option.py script a bit, all cpd.settings[<option>].XXX union accessors seem to be the proper ones.
Keep in mind that you are throwing away the -std=gnu++0x, the compiler might complain that we are using c++11 stuff.
Building with -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -g -O1 -std=gnu++0x I don't get errors or warnings on my box.
Why are we using -std=gnu++0xhere instead of -std=c++11?
Nothing to control cpd.al_cnt which becomes 81 at column 358 from the input file bug_139.cpp,
but the array al is declared as: align_t al[80];
which is the address of cpd.settings[1].n
There might be some more places that must be controled.
Activity
gerasiov commentedon Nov 10, 2017
Ok, I need to pause my research for now =(
What did I found.
Steps to reproduce segfault:
$ cat bug_1349.cfg
$ cat bug_1349.cpp
Then run the following commands:
And you should catch segmentation fault.
There are also some differences in logfile produced with -LA if you compare optimized and no-optimized versions.
gerasiov commentedon Nov 10, 2017
Ah. I checked old versions and found the problem exists at least since switch to cmake.
gerasiov commentedon Nov 10, 2017
Stracktrace itself:
CDanU commentedon Nov 10, 2017
Thanks for the trace, I however don't really see a problem in the
op_val_to_stringfunction.I actually have a blank line at 2782, so that should be either
return(tfi_to_string(op_val.tfi));but that can't happen as there currently no TFI options to trigger this
or
Only the
number_to_stringfunction inop_val_to_stringis slightly sketchy, that is going to be replaced by std::to_string soon.Ohh maybe it is accessing the union in a wrong way
-p has to be used to enter the
output_parsedfunctionnote that this happens on the
33057-bug_1349.cpp.uncfile, I think this happens on the rerun test stepthe tests don't use the -p flag ...
@gerasiov: did you use the -p flag here? If so this might be an entirely different bug.
I modified the
check_option.pyscript a bit, all cpd.settings[<option>].XXX union accessors seem to be the proper ones.guy-maurel commentedon Nov 10, 2017
I am working on it.
The problem seams to be very deep.
guy-maurel commentedon Nov 10, 2017
The use of
export CXXFLAGS="-g -O1"produce also at me many errors.The problem is not at the output.cpp but deeper.
CDanU commentedon Nov 10, 2017
Keep in mind that you are throwing away the
-std=gnu++0x, the compiler might complain that we are using c++11 stuff.Building with
-Wall -Wextra -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -g -O1 -std=gnu++0xI don't get errors or warnings on my box.Why are we using
-std=gnu++0xhere instead of-std=c++11?guy-maurel commentedon Nov 11, 2017
Error found.
At align.cpp about lines 1688.. is:
Nothing to control
cpd.al_cntwhich becomes 81 at column 358 from the input file bug_139.cpp,but the array al is declared as:
align_t al[80];which is the address of
cpd.settings[1].nThere might be some more places that must be controled.
guy-maurel commentedon Nov 12, 2017
#1438 is a bugfix proposal. Look also at #1349
Please test it and report.
misery commentedon Nov 15, 2017
Same on AlpineLinux: alpinelinux/aports@8dd2436
guy-maurel commentedon Nov 16, 2017
Could you please test the current git version at 82c2a89
and report.
gerasiov commentedon Nov 17, 2017
4597d37 works fine for me.
All autotests pass on several architectures I tried.
Waiting for release to upload it into Debian. Good work.
misery commentedon Nov 24, 2017
Thanks... 0.66.1 fixed Alpine, too.