gnuplot segfaults after a fit on linux/amd64. more
details in the following gentoo bug report:
http://bugs.gentoo.org/show_bug.cgi?id=46981
the problem is with the 2 consecutive calls to
vfprintf() in Dblfn()/fit.c (line 1688 in the 3.8k.3
sources).
according to the c99 standard (7.15 par 3), a function
calling va_arg on a va_list-type parameter (here
vfprintf and args respectively) will leave it in an
undefined state in the calling function - that makes
the second vfprintf call (the one that segfaults) have
an invalid argument.
Logged In: YES
user_id=27517
I see. This will get fixed for the 4.0 release by inserting
a va_end+va_start pair between the two vfprintf()s.
Which just leaves one point to be analyzed, if any: this
code has been in exactly that shape you see it in for almost
5 years. That's considerably longer than either Gentoo or
AMD64 have existed --- so how come nobody noticed it
earlier? gnuplot has been working on 64-bit platforms for
ages, without any serious glitches.
For the record: I suspect the -fomit-frame-pointer option
used by the OP of that Gentoo bugzilla entry.
Logged In: YES
user_id=1016107
I don't think it's the frame pointer - the same problem
appeared with CFLAGS="-g" in the debug build. I'm nore
inclined to suspect the glibc compile flags - most of the
time they're really conservative, maybe the gentoo build
optimized away some silent errors? To be honest, I'm as
surprised as you are this issue stayed hidden for so long. :-)