a bug in sum command

Bugs

Modérateur : xcasadmin

lukamar
Messages : 331
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

a bug in sum command

Message par lukamar » jeu. sept. 13, 2018 2:23 pm

Hello,
there's a bug in sum command, it causes Xcas to crash while executing the second of these two commands:

Code : Tout sélectionner

assume(n,integer);
sum(1/k,k=1..n)
I know that the closed formula can't be derived, but it shouldn't crash.

parisse
Messages : 5734
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: a bug in sum command

Message par parisse » ven. sept. 14, 2018 9:08 am

It doesn't crash here. Have you some special settings?

lukamar
Messages : 331
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

Re: a bug in sum command

Message par lukamar » ven. sept. 14, 2018 11:23 am

It's Xcas 1.4.9 but compiled on my system (Debian 9). It segfaults on the above command. Probably some difference in settings. I can't reproduce in Giac shell.
What's the executable of xcas after compiling from source? There is only a script xcas which runs it, but I didn't manage to find what exactly. I need it to run gdb for a backtrace.

parisse
Messages : 5734
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: a bug in sum command

Message par parisse » ven. sept. 14, 2018 2:57 pm

the script runs .libs/xcas after setting LD_LIBRARY_PATH to make sure it links with the libraries in .libs.
Hence
cd .libs
export LD_LIBRARY_PATH=.
./xcas
should run the right executable with the right libraries.

lukamar
Messages : 331
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

Re: a bug in sum command

Message par lukamar » ven. sept. 14, 2018 9:43 pm

It crashes in r2sym (in sym2poly.cc at line 2223). This is just for the info, it probably does not matter anyway.

frederic han
Messages : 1137
Inscription : dim. mai 20, 2007 7:09 am
Localisation : Paris
Contact :

Re: a bug in sum command

Message par frederic han » dim. sept. 16, 2018 4:14 pm

NB: on fedora amd64 (fedora official package: giac 1.4.9.59 )
without the assume n integer I have the answer, but with the assume n integer it also crashes.

Code : Tout sélectionner

0>> sum(1/k,k,1,n)
Psi(n+1)+euler_gamma
// Time 0
1>> assume(n,integer)
integer
// Time 0
2>> sum(1/k,k,1,n)
Segmentation fault (core dumped)

parisse
Messages : 5734
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: a bug in sum command

Message par parisse » dim. sept. 16, 2018 8:00 pm

Everything seems fine here, also with valgrind.
export GIAC_RELEASE=1
valgrind ./icas bug >& log

Code : Tout sélectionner

==31067== Memcheck, a memory error detector
==31067== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==31067== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==31067== Command: ./icas bug
==31067== 
// Using locale /usr/local/share/locale/
// fr_FR.UTF-8
// /usr/local/share/locale/
// giac
// UTF-8
// Maximum number of parallel threads 2
// Giac share root-directory:/usr/local/share/giac/
// Giac share root-directory:/usr/local/share/giac/
Help file /usr/local/share/giac/doc/fr/aide_cas not found
Added 0 synonyms
// Giac share root-directory:/usr/local/share/giac/
integer,
// Time 0.17

Evaluation time: 1.11
Psi(n+1)+euler_gamma
// Time 1.13
// Total time 1.3
==31067== 
==31067== HEAP SUMMARY:
==31067==     in use at exit: 1,030,550 bytes in 1,092 blocks
==31067==   total heap usage: 182,336 allocs, 181,244 frees, 11,037,100 bytes allocated
==31067== 
==31067== 27 bytes in 1 blocks are possibly lost in loss record 53 of 208
==31067==    at 0x4C286E7: operator new(unsigned long) (vg_replace_malloc.c:287)
==31067==    by 0x93E7CC8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (new_allocator.h:104)
==31067==    by 0x93E8AAA: std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned long) (basic_string.tcc:1073)
==31067==    by 0x93E8B53: std::string::reserve(unsigned long) (basic_string.tcc:954)
==31067==    by 0x93E8DC2: std::string::append(char const*, unsigned long) (basic_string.tcc:752)
==31067==    by 0x4397AF: std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*) (basic_string.h:2202)
==31067==    by 0xC9B935: giac::xcasroot_dir(char const*) (help.cc:1050)
==31067==    by 0x121D00D: main (icas.cc:892)
==31067== 
==31067== 45 (16 direct, 29 indirect) bytes in 1 blocks are definitely lost in loss record 78 of 208
==31067==    at 0x4C28BED: malloc (vg_replace_malloc.c:263)
==31067==    by 0x789C87F: XCreateFontSet (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==31067==    by 0x12870E6: fl_new_ic() (Fl_x.cxx:385)
==31067==    by 0x12876F1: fl_init_xim() (Fl_x.cxx:564)
==31067==    by 0x1287C2E: fl_open_display(_XDisplay*) (Fl_x.cxx:644)
==31067==    by 0x128782D: fl_open_display() (Fl_x.cxx:596)
==31067==    by 0x122CECC: Fl_Gl_Choice::find(int, int const*) (Fl_Gl_Choice.cxx:110)
==31067==    by 0x122CBA1: Fl::gl_visual(int, int*) (gl_start.cxx:113)
==31067==    by 0x121D08B: main (icas.cc:905)
==31067== 
==31067== 49 bytes in 1 blocks are possibly lost in loss record 84 of 208
==31067==    at 0x4C286E7: operator new(unsigned long) (vg_replace_malloc.c:287)
==31067==    by 0x93E7CC8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (new_allocator.h:104)
==31067==    by 0x93E7F9A: std::string::_M_mutate(unsigned long, unsigned long, unsigned long) (basic_string.tcc:923)
==31067==    by 0x93E85BD: std::string::_M_replace_safe(unsigned long, unsigned long, char const*, unsigned long) (basic_string.tcc:1128)
==31067==    by 0x4EC726: xcas::objet_bidon::objet_bidon() (Graph.cc:261)
==31067==    by 0x4BFEA2: __static_initialization_and_destruction_0(int, int) (Tableur.cc:66)
==31067==    by 0x4C0517: global constructors keyed to _ZN4xcas23mon_objet_bidon_tableurE (Tableur.cc:3653)
==31067==    by 0x18B6DDC: __libc_csu_init (in /home/parisse/giac-1.5.0/src/icas)
==31067==    by 0x9B63E3F: (below main) (libc-start.c:203)
==31067== 
==31067== 640 bytes in 1 blocks are definitely lost in loss record 168 of 208
==31067==    at 0x4C28BED: malloc (vg_replace_malloc.c:263)
==31067==    by 0x78B6A65: XGetVisualInfo (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==31067==    by 0x1287BFC: fl_open_display(_XDisplay*) (Fl_x.cxx:642)
==31067==    by 0x128782D: fl_open_display() (Fl_x.cxx:596)
==31067==    by 0x122CECC: Fl_Gl_Choice::find(int, int const*) (Fl_Gl_Choice.cxx:110)
==31067==    by 0x122CBA1: Fl::gl_visual(int, int*) (gl_start.cxx:113)
==31067==    by 0x121D08B: main (icas.cc:905)
==31067== 
==31067== 640 bytes in 1 blocks are definitely lost in loss record 169 of 208
==31067==    at 0x4C28BED: malloc (vg_replace_malloc.c:263)
==31067==    by 0x78B6A65: XGetVisualInfo (in /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==31067==    by 0x6CB3E03: ??? (in /usr/lib/x86_64-linux-gnu/libGL.so.1.5.08005)
==31067==    by 0x6CB5F2B: ??? (in /usr/lib/x86_64-linux-gnu/libGL.so.1.5.08005)
==31067==    by 0x6CB60BE: ??? (in /usr/lib/x86_64-linux-gnu/libGL.so.1.5.08005)
==31067==    by 0x122CEE7: Fl_Gl_Choice::find(int, int const*) (Fl_Gl_Choice.cxx:111)
==31067==    by 0x122CBA1: Fl::gl_visual(int, int*) (gl_start.cxx:113)
==31067==    by 0x121D08B: main (icas.cc:905)
==31067== 
==31067== 28,808 bytes in 1 blocks are possibly lost in loss record 204 of 208
==31067==    at 0x4C28147: operator new[](unsigned long) (vg_replace_malloc.c:348)
==31067==    by 0xC2CCA9: giac::builtin_lexer_functions() (global.cc:6692)
==31067==    by 0xC2CD6C: giac::builtin_lexer_functions_begin() (global.cc:6699)
==31067==    by 0xC22E34: giac::lexer_functions_register(giac::unary_function_ptr const&, char const*, int) (global.cc:5480)
==31067==    by 0x1212E4F: giac::unary_function_ptr::unary_function_ptr(giac::unary_function_abstract const*, int, int) (unary.cc:134)
==31067==    by 0x5B44B1: __static_initialization_and_destruction_0(int, int) (sym2poly.cc:174)
==31067==    by 0x5B47B1: global constructors keyed to _ZN4giac8dbgprintERKNS_6tensorINS_3genEEE (sym2poly.cc:4142)
==31067==    by 0x18B6DDC: __libc_csu_init (in /home/parisse/giac-1.5.0/src/icas)
==31067==    by 0x9B63E3F: (below main) (libc-start.c:203)
==31067== 
==31067== LEAK SUMMARY:
==31067==    definitely lost: 1,296 bytes in 3 blocks
==31067==    indirectly lost: 29 bytes in 1 blocks
==31067==      possibly lost: 28,884 bytes in 3 blocks
==31067==    still reachable: 1,000,341 bytes in 1,085 blocks
==31067==         suppressed: 0 bytes in 0 blocks
==31067== Reachable blocks (those to which a pointer was found) are not shown.
==31067== To see them, rerun with: --leak-check=full --show-reachable=yes
==31067== 
==31067== For counts of detected and suppressed errors, rerun with: -v
==31067== ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 13 from 7)

Répondre