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

New issue 178 by emil.len...@gmail.com: Constants of type "Single" does not  
work in some cases. Segmentation fault.
http://code.google.com/p/gambas/issues/detail?id=178

1) Describe the problem.
Constants of type "Single" does not work in some cases.

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

Version: TRUNK
Revision: r4368

3) Provide a little project that reproduces the bug or the crash.
MMain:
Public Const a As Single = 123.45

Public Sub Main
   Print MMain.a
End

4) If your project needs a database, try to provide it, or part of it.

5) Explain clearly how to reproduce the bug or the crash.
Create the Module MMain with the contents above. The interpreter crashes  
with a segmentation fault.

One part of why it is going wrong is the code in gbx_class_load.c:
         if (TYPE_is_integer(desc->constant.type))
           desc->constant.value._integer = cc->_integer.value;
         else if (desc->constant.type == T_FLOAT)
           desc->constant.value._float = cc->_float.value;
         else if (desc->constant.type == T_LONG)
           desc->constant.value._long = cc->_long.value;
         else
         {
           desc->constant.type = T_CSTRING;
           desc->constant.value._string = cc->_string.addr;
                                        desc->constant.translate = (cc->type == 
T_CSTRING);
         }

The desc->constant.type is T_SINGLE, so the else part runs..

The actual crash is at
VALUE_read(&SP[-1], (void *)&desc->constant.value, desc->constant.type);
in gbx_exec_push.c, as it tries to read a string at a bad address instead...


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to