Euphoria Ticket #767: Translated program closes silently during insert()

I have a program:

include std/console.e 
 
procedure test(atom x) 
    sequence objs = {} 
    integer k = 1 
    puts(1,"Inserting...\n") 
    objs = insert(objs, x, k) 
    puts(1,"Success!\n") 
end procedure 
 
test(1) 
 
any_key() 

It works fine being interpreted, but it doesn't reach puts(1,"Success!\n") if translated and compiled with MinGW, just silently closes itself.

Euc ver:

Euphoria to C Translator v4.0.4 
   Windows, Using Managed Memory 
   Revision Date: 2012-04-02, Id: 11a49820121f 

gcc version: 4.6.1

Platform: WinNT, Build: Windows7, Service Pack 1:2

Details

Type: Bug Report Severity: Major Category: Translator
Assigned To: mattlewis Status: Fixed Reported Release: 4.0.4
Fixed in SVN #: View VCS: none Milestone: 4.0.5

1. Comment by mattlewis May 19, 2012

The problem is that the translator is incorrectly assuming that test() parameter x is a double and needs its reference count incremented in compile.e.

2. Comment by mattlewis May 19, 2012

See: hg:euphoria/rev/cbdc7d2e4930

changeset: 5560:cbdc7d2e4930 branch: 4.0 tag: tip user: Matt Lewis date: Sat May 19 17:33:48 2012 -0400 files: docs/installing.txt docs/release/4.0.5.txt source/compile.e tests/t_sequence.e description:

  • fix segfault when translated code uses insert() to insert an atom stored as an integer
  • fixes ticket 767

3. Comment by Insolor May 20, 2012

BTW, I noticed that insert() in a translated program doesn't check if a sequence is initialized, and the program silently closes if it isn't. Is such a behaviour expected?

4. Comment by mattlewis May 20, 2012

Yes, that behavior is expected. The translator omits lots of checks like that, which is part of how it results in faster code.

5. Comment by DerekParnell May 21, 2012

The approach that we recommend is that one debugs an application using the interpreter and then when acceptable, translate it for publication.

6. Comment by Insolor Oct 21, 2012

Well, the sample code works now, but I suspect there is a memory leak inside insert() in a translated program. So the new ticket will be added soon.

Search



Quick Links

User menu

Not signed in.

Misc Menu