This is quite easy, why it doesn't - since before this check there is another (line 373):
if (ret <= args)
and, of course, value of "ret" is 0, value of "args" is 0 too, so... :)
Yes, that looks bogus. It should be < there.
But I wonder why this bug doesn't happen in 7.4 (same check order)...
The bug was that a freed svalue on the stack was copied into the exception struct if the function was called with no arguments. That only led to a failure if the stack svalue pointed to a refcounted value of some sort. So whether or not you get the bug depended on the code further up. It took me a while to figure out a test that consistently trigs it:
void trig_bug() { lambda (mixed a, mixed b, mixed c) {} (({time()}), ({time()}), ({time()})); // set_weak_flag uses get_all_args and requires two arguments. ([function] set_weak_flag)(); }
I guess there's some kind of subtle difference in the stack handling between 7.4 and 7.5 that caused it to happen only in 7.5 in your case.
Also, compiling pike with --with-rtldebug and without --without-cdebug (or without stripping) helps quite a lot in tracking down bugs.
Perhaps, you mean --with-cdebug?
That should work too, but since it's the default I did actually mean without --without-cdebug.
No idea why gdb shows no args in backtrace...
The binary doesn't get stripped somewhere? When I hack Pike on the C level, I usually compile it with a plain "make" and run it directly in the build tree through the bin/pike script. It's not stripped then, at least.
Anyway, the backtrace is strange (perhaps because of longjmp() - there is no trace of get_all_args()).
That was because the use of the bogus svalue caused an error first when the exception is handled.
/ Martin Stjernholm, Roxen IS
Previous text:
2004-02-28 04:30: Subject: Re: Problem with function prototypes
On Fri, Feb 27, 2004 at 11:45:03PM +0100, Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
to whip out gdb and find out why the check for too few arguments on line 381 in src/module_support.c doesn't work.
This is quite easy, why it doesn't - since before this check there is another (line 373):
if (ret <= args)
and, of course, value of "ret" is 0, value of "args" is 0 too, so... :)
I guess, the number of arguments must be checked first... But I wonder why this bug doesn't happen in 7.4 (same check order)...
Also, compiling pike with --with-rtldebug and without --without-cdebug (or without stripping) helps quite a lot in tracking down bugs.
Perhaps, you mean --with-cdebug? I did so, but without RTL debug code. No idea why gdb shows no args in backtrace... Anyway, the backtrace is strange (perhaps because of longjmp() - there is no trace of get_all_args()).
Regards, /Al
/ Brevbäraren