1. integer constant overflow

Euphoria Interpreter v4.0.0
Linux, Using System Memory
Revision Date: 2010-12-22, Id: 115714454200

the following code crashes when run after translation

the translation commands are

$ euc -con test.ex
$ ./test

constant MINVAL_1 = 2.0 
atom     MINVAL_2 = 2.0 
 
function doit() 
 
   atom amt1 = 0 
   atom amt2 = 0 
   atom amt3 = 0 
   atom amt4 = 0 
 
   amt1 += MINVAL_1 
   amt2 -= MINVAL_1 
 
   amt3 += MINVAL_2 
   amt4 -= MINVAL_2 
 
   return 0 
 
end function 
 
? doit() 
 


part of the generated code 'test.c' contains

    /**  amt1 += MINVAL_1*/ 
    _amt1_145 = NewDouble((double)0 + DBL_PTR(-1295837195870999949586246503082820524326358132599250911397783755038038489864013682116184556430441987592636661296475806242151395110594288345544824579900198053196264090075980164902 
1131955125999812493113783567960893398430315545464157532966734476954357462767975066016679066281769169231978029986946841820052586496)->dbl); 
 
    /**  amt2 -= MINVAL_1*/ 
    _amt2_146 = NewDouble((double)0 - DBL_PTR(-1295837195870999949586246503082820524326358132599250911397783755038038489864013682116184556430441987592636661296475806242151395110594288345544824579900198053196264090075980164902 
1131955125999812493113783567960893398430315545464157532966734476954357462767975066016679066281769169231978029986946841820052586496)->dbl); 
 
    /**  amt3 += MINVAL_2*/ 
    _amt3_147 = NewDouble((double)0 + DBL_PTR(_1MINVAL_2_142)->dbl); 
 
    /**  amt4 -= MINVAL_2*/ 
    _amt4_148 = NewDouble((double)0 - DBL_PTR(_1MINVAL_2_142)->dbl); 


gcc compiles fine without error, but the app crashes when run.

tcc (Tiny CC, Fabrice Bellard) does not compile, and crashes
with integer constant overflow error

new topic     » topic index » view message » categorize

2. Re: integer constant overflow

Confirmed on Linux. It looks like the problem is in the code generation for "constant"

new topic     » goto parent     » topic index » view message » categorize

3. Re: integer constant overflow

I was playing with this and found another bug - the interpreter does not handle scientific notation correctly. See ticket:609

new topic     » goto parent     » topic index » view message » categorize

4. Re: integer constant overflow

jaygade said...

... It looks like the problem is in the code generation for "constant"

Thanks for the tip. I have a program that uses win32lib. It runs ok using eui. It compiles without complaint using openWatcom, executes without complaint and also, unfortunately, without opening its window. After changing most of the constant declarations to sequence, integer, or atom the compiled program runs properly.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu