Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime crash #2

Open
lukacsarpad opened this issue Dec 27, 2018 · 6 comments
Open

runtime crash #2

lukacsarpad opened this issue Dec 27, 2018 · 6 comments

Comments

@lukacsarpad
Copy link

The attached code (ACM Algorithm 003: Finding roots of polynomials by the Bairstow-Hitchcock method) crashes on linux (ubuntu 16.04) with:
*** Error in `./001_bairstow2': free(): invalid next size (fast): 0x0000000000f8c0b0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f97f2ecf7e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f97f2ed837a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f97f2edc53c]
./001_bairstow2[0x402010]
./001_bairstow2[0x401815]
./001_bairstow2[0x400c78]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f97f2e78830]
./001_bairstow2[0x400e49]
======= Memory map: ========
00400000-00405000 r-xp 00000000 09:00 7869045 /home/arpi/programming/a60/toms/001_bairstow2
00605000-00606000 r--p 00005000 09:00 7869045 /home/arpi/programming/a60/toms/001_bairstow2
00606000-00607000 rw-p 00006000 09:00 7869045 /home/arpi/programming/a60/toms/001_bairstow2
00f8c000-00fad000 rw-p 00000000 00:00 0 [heap]
7f97ec000000-7f97ec021000 rw-p 00000000 00:00 0
7f97ec021000-7f97f0000000 ---p 00000000 00:00 0
7f97f2c42000-7f97f2c58000 r-xp 00000000 08:21 5247481 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f97f2c58000-7f97f2e57000 ---p 00016000 08:21 5247481 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f97f2e57000-7f97f2e58000 rw-p 00015000 08:21 5247481 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f97f2e58000-7f97f3018000 r-xp 00000000 08:21 5254184 /lib/x86_64-linux-gnu/libc-2.23.so
7f97f3018000-7f97f3218000 ---p 001c0000 08:21 5254184 /lib/x86_64-linux-gnu/libc-2.23.so
7f97f3218000-7f97f321c000 r--p 001c0000 08:21 5254184 /lib/x86_64-linux-gnu/libc-2.23.so
7f97f321c000-7f97f321e000 rw-p 001c4000 08:21 5254184 /lib/x86_64-linux-gnu/libc-2.23.so
7f97f321e000-7f97f3222000 rw-p 00000000 00:00 0
7f97f3222000-7f97f332a000 r-xp 00000000 08:21 5244227 /lib/x86_64-linux-gnu/libm-2.23.so
7f97f332a000-7f97f3529000 ---p 00108000 08:21 5244227 /lib/x86_64-linux-gnu/libm-2.23.so
7f97f3529000-7f97f352a000 r--p 00107000 08:21 5244227 /lib/x86_64-linux-gnu/libm-2.23.so
7f97f352a000-7f97f352b000 rw-p 00108000 08:21 5244227 /lib/x86_64-linux-gnu/libm-2.23.so
7f97f352b000-7f97f3551000 r-xp 00000000 08:21 5254182 /lib/x86_64-linux-gnu/ld-2.23.so
7f97f371f000-7f97f3723000 rw-p 00000000 00:00 0
7f97f374f000-7f97f3750000 rw-p 00000000 00:00 0
7f97f3750000-7f97f3751000 r--p 00025000 08:21 5254182 /lib/x86_64-linux-gnu/ld-2.23.so
7f97f3751000-7f97f3752000 rw-p 00026000 08:21 5254182 /lib/x86_64-linux-gnu/ld-2.23.so
7f97f3752000-7f97f3753000 rw-p 00000000 00:00 0
7ffd774af000-7ffd774d0000 rw-p 00000000 00:00 0 [stack]
7ffd775a5000-7ffd775a8000 r--p 00000000 00:00 0 [vvar]
7ffd775a8000-7ffd775aa000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted (core dumped)

The same code (with fabs replaced by abs and using # instead of e for scientific form constants) runs with MARST and generates the output provided in the certification of the algorithm.
003_bairstow2.txt

@JvanKatwijk
Copy link
Owner

JvanKatwijk commented Dec 27, 2018 via email

@lukacsarpad
Copy link
Author

Yes, this seems correct, thank you.

Also, I wanted to ask you if you are sure that fabs() shall be used for floating point numbers. MARST seems to accept abs(), and the original TOMS algorithms use abs() too.

@JvanKatwijk
Copy link
Owner

JvanKatwijk commented Dec 27, 2018 via email

@JvanKatwijk
Copy link
Owner

JvanKatwijk commented Dec 27, 2018 via email

@lukacsarpad
Copy link
Author

Somehow I cannot reproduce the correct results with the new version. I get
Roots found by Bairstow's method.
i ex nat x y
1 1 -1 -1.012085580 1.008068111
2 1 -1 2.512085580 4.671048047
Roots found by Bairstow's method.
i ex nat x y
1 3 -1 0.5073488146 0.8601905079
2 1 1 -2.926409128e-3 -632542.6365
3 1 -1 316271.8123 547798.2775
Program end.

@JvanKatwijk
Copy link
Owner

JvanKatwijk commented Jan 6, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants