Status: New
Owner: ----
Labels: Version Type-Bug Priority-Medium OpSys-Any Dist-Any Arch-Any  
Desktop-Any GUI-Any

New issue 135 by emil.len...@gmail.com: Cannot use vararg in functions with  
optional arguments - Segmentation fault
http://code.google.com/p/gambas/issues/detail?id=135

1) Describe the problem.
When you call a function that has optional arguments and vararg, the  
interpreter exits with a Segmentation fault.

2) GIVE THE FOLLOWING INFORMATIONS (if they are appropriate):

Version: TRUNK
Revision: r4222

3) Provide a little project that reproduces the bug or the crash.
Public Sub CrashFunction(Optional a As Integer, ...)
End

Public Sub Main()
     CrashFunction(1, 2)
End

5) Explain clearly how to reproduce the bug or the crash.
Run the code.

6) By doing that carefully, you have done 50% of the bug fix job!

The error seems to be in gbx_exec.c from line 461 and forward.
If there are at least one optional argument in the signature, it assumes  
all of the following arguments are optional, but they might in fact be  
varargs.

First change line 465 to
for (i = func->npmin; i < Min(func->n_param, nparam); i++)
instead of
for (i = func->npmin; i < nparam; i++)

But I don't know what to do with line 501 if some optional arguments were  
missing...


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to