1. Compiler crash?

When i compile this program with Watcom the program open a console window with
no output.
Using Borland it produce the usual window error message. 
Is it a bug in ecw?

exw test-mydll.exw -- ok
bind test-mydll.exw -- ok
ecw -wat test-mydll.exw -- console no output
ecw -bor test-mydll.exw -- crash with windows error.

--------- test-mydll.exw
without warning
include dll.e

atom dll, up

dll = open_dll("mydll")
up = define_c_func(dll, "upper", {E_OBJECT}, E_OBJECT)

-- puts(1, c_func(up, {"aBcDEfg"}))
for n=1  to  1000  do
    puts(1, c_func(up, {rand("abcdefghijklmnopqrstuv") + ' '}) & '\n')
end for

while get_key() = -1 do
    
end while

--------- mydll.ew

function to_upper(sequence s)
    integer i
    for c=1  to length(s)  do
	i = s[c]
	if i >= 'a' then
	    if i <= 'z' then
		s[c] -= ' '
	    end if
	end if
    end for
    return s
end function

global function upper(object x)

    return to_upper(x)
end function

-------------------------
tj

new topic     » topic index » view message » categorize

2. Re: Compiler crash?

Thomas Jansen wrote:
> When i compile this program with Watcom the program open a console window with
> no output.
> Using Borland it produce the usual window error message. 
> Is it a bug in ecw?
> 
> exw test-mydll.exw -- ok
> bind test-mydll.exw -- ok
> ecw -wat test-mydll.exw -- console no output
> ecw -bor test-mydll.exw -- crash with windows error.
> 
> --------- test-mydll.exw
> without warning
> include dll.e
> 
> atom dll, up
> 
> dll = open_dll("mydll")
> up = define_c_func(dll, "upper", {E_OBJECT}, E_OBJECT)
> 
> -- puts(1, c_func(up, {"aBcDEfg"}))
> for n=1  to  1000  do
>     puts(1, c_func(up, {rand("abcdefghijklmnopqrstuv") + ' '}) & '\n')
> end for
> 
> while get_key() = -1 do
>     
> end while
> 
> --------- mydll.ew
> 
> function to_upper(sequence s)
>     integer i
>     for c=1  to length(s)  do
> 	i = s[c]
> 	if i >= 'a' then
> 	    if i <= 'z' then
> 		s[c] -= ' '
> 	    end if
> 	end if
>     end for
>     return s
> end function
> 
> global function upper(object x)
> 
>     return to_upper(x)
> end function

Thanks for reporting this.
I haven't had time to pin it down exactly. (It's getting late here.)
It's probably a code generation error.
Meanwhile, for me at least, the bug goes away if you use two
calls to puts() inside the for-loop instead of one:
puts(1, c_func(up, {rand("abcdefghijklmnopqrstuv") + ' '}))
    puts(1, '\n') 


Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

3. Re: Compiler crash?



puts(1, c_func(up, {rand("abcdefghijklmnopqrstuv") + ' '}) & '\n')


I've had time to pin it down now.
The bug is caused because the Translator assumes
that c_func() must always return an atom. This used to be true
a few years ago, and is still true if you only call C-coded 
functions in .dlls. However it is possible to call a 
Euphoria-coded function in a .dll, and that function might be one
that returns a sequence. Above, the translator uses this bad assumption 
and produces incorrect code for the concatenation step. 
If you assign the result of c_func() to a variable,
or if your Euphoria function does in fact return an atom, 
there shouldn't be a problem. Also, in the example above,
you could split the statement into two simpler statements. 
In more complicated expressions, bad C code could result. 
I'll fix it for the next release. It's just a one-line change.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

4. Re: Compiler crash?

Robert Craig wrote:
> 
> }}}
<eucode>
>   puts(1, c_func(up, {rand("abcdefghijklmnopqrstuv") + ' '}) & '\n')
> <font color="#330033"></eucode>
{{{
</font>
> 
> I've had time to pin it down now.
> The bug is caused because the Translator assumes
> that c_func() must always return an atom. This used to be true
> a few years ago, and is still true if you only call C-coded 
> functions in .dlls. However it is possible to call a 
> Euphoria-coded function in a .dll, and that function might be one
> that returns a sequence. Above, the translator uses this bad assumption 
> and produces incorrect code for the concatenation step. 
> If you assign the result of c_func() to a variable,
> or if your Euphoria function does in fact return an atom, 
> there shouldn't be a problem. Also, in the example above,
> you could split the statement into two simpler statements. 
> In more complicated expressions, bad C code could result. 
> I'll fix it for the next release. It's just a one-line change.
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>
> 

Werent you planning on releasing v2.5.1? Or did it turn out that there wasnt a
significant enough amount of bug fixes, after the official release to be worth
the effort of updating the email links and website?

Regards,
Vincent

--
Without walls and fences, there is no need for Windows and Gates.

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

5. Re: Compiler crash?

Vincent wrote:
> Werent you planning on releasing v2.5.1? Or did it turn out that there wasnt a
> significant
> enough amount of bug fixes, after the official release to be worth the effort
> of updating
> the email links and website?

I might still do that, but I don't feel like I have enough
serious bugs yet to justify the week or so that it takes me 
to prepare a release (build and test all products on 4 platforms, 
re-zip everything, update the docs, the Web site etc.). Most people would 
not be affected by any of the bugs that have been reported so far.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

6. Re: Compiler crash?

Robert Craig wrote:
> 
> 
> posted by: Robert Craig <rds at RapidEuphoria.com>
> 
> Vincent wrote:
> 
>>Werent you planning on releasing v2.5.1? Or did it turn out that there wasnt a
>>significant
>>enough amount of bug fixes, after the official release to be worth the effort
>>of updating
>>the email links and website?
> 
> 
> I might still do that, but I don't feel like I have enough
> serious bugs yet to justify the week or so that it takes me 
> to prepare a release (build and test all products on 4 platforms, 
> re-zip everything, update the docs, the Web site etc.). Most people would 
> not be affected by any of the bugs that have been reported so far.
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    http://www.RapidEuphoria.com

If it will be awhile before some of these bugs are fixed I think that it 
would be a good idea to put a "Known Bugs" section with workarounds on 
the website.

If not that could you at least add known bugs and workarounds to the 
online release notes?

The point being although these bugs are relatively minor and affect few 
people it would be nice to have a centralized spot for them so that 
users don't have an unexpected condition and then have to post here or 
search the message archives.

-- 
==============================
Too many freaks, not enough circuses.
j.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu