Menu

#17 Crashing on exponential of large number when precision is not -1

1.x
wont-fix
None
5
2015-11-18
2013-11-15
Manifold
No

Hello,

Using the latest wcalc, 4.2.1, I can segfault consistently by doing:

  1. wcalc -P10
  2. exp(-581)

I'm running: Linux 3.12.0-1-ARCH #1 SMP PREEMPT x86_64 GNU

Discussion

  • Kyle Wheeler

    Kyle Wheeler - 2013-11-15

    I ran it as: ./wcalc --defaults -P10 'exp(-581)' and got the output:
    = 4.7304887525e-253

    If you are getting a seg-fault, I'm guessing it is triggered by one of your configuration settings. Can you post your ~/.wcalcrc so I can duplicate exactly what wcalc is doing?

    Also, try testing with the --defaults argument, which forces wcalc to ignore your ~/.wcalcrc. If you can replicate my success, then we'll know we're getting somewhere. Otherwise, it suggests a problem in your build of wcalc, rather than in wcalc itself.

     
    • Manifold

      Manifold - 2013-11-15

      If I run

      wcalc --defaults -P10 'exp(-581)'

      I get

      = 0.0000000000
      Segmentation fault (core dumped)

      As far as I'm aware, I don't have a .wcalcrc.

      I'm using archlinux - don't know if you're aware of its packaging system, though it should be reasonably transparent. Here it is: https://aur.archlinux.org/packages/wc/wcalc/PKGBUILD

      As you can see, there doesn't appear to be any custom flags set.

      I see that wcalc depends on mpfr. My version of that is 3.1.2.p3-2

      Hope I can be of further help.

       

      Last edit: Manifold 2013-11-15
  • Kyle Wheeler

    Kyle Wheeler - 2013-11-15
    • status: open --> pending
     
  • Kyle Wheeler

    Kyle Wheeler - 2013-11-15

    Hrm. I don't have access to a machine with 3.1.2... my Ubuntu box has 3.1.1, and my Debian has 3.1.0. Further, valgrind seems to indicate a clean execution, which doesn't really help. Are you able to put it in a debugger and get a backtrace of where it's segfaulting? Maybe that can help me narrow it down.

     
    • Manifold

      Manifold - 2013-11-16

      I've attempted to add the debug flag before compiling by following this procedure (http://stackoverflow.com/a/4680578/1358677). Please advise if there's a better way because the gdb output still appears to have some optimisation. Here's the output of gdb http://pastebin.com/YFknYmsS

      Note: if I run the binary compiled by the package manager, there's a crash. What's really weird is if I compile a manually downloaded version of wcalc, then run ./wcalc --defaults -P10 'exp(-581)' there is no crash..

       

      Last edit: Manifold 2013-11-16
  • Kyle Wheeler

    Kyle Wheeler - 2015-11-18

    Since we can't recreate this bug with the source you can download from this repo, I suspect this must be a bug created by some patch your distribution has added. As such, until we can get more clarity, I'm going to close this bug. If we get more information about how to generate the crash, we can re-open.

     
  • Kyle Wheeler

    Kyle Wheeler - 2015-11-18
    • status: pending --> wont-fix
     

Log in to post a comment.