Euphoria Ticket #908: translator segfault with routine_id

segfault if calls routine_id with sequence variable declared in include file. Not with sequence elements.

-- file1.e
public sequence s  = {"func1", "func2"}  
public sequence s1 = s[1]  
public sequence s2 = s[2]  
  
-- file2.e  
public function func1()  
    return {1,2,3}  
end function  
  
public function func2()  
    return 25  
end function  
  
-- file.ex  
include file1.e  as f1 
include file2.e  
  
puts(1, s[1] & ", " & s[2] & 10)  
puts(1, s1 & 10)  
puts(1, s2 & 10)  
  
--atom x = routine_id(s1)   -- translator (segfault), eui Ok  
atom x = routine_id(s[1])   -- translate, compile and run Ok  
  
? call_func(x, {})  
x = routine_id(s[2])  
? call_func(x, {})  
  
sequence ss = "func1" 
x = routine_id(ss)          -- Ok 
? call_func(x, {}) 
 
ss = s1 
x = routine_id(ss)          -- Ok 
? call_func(x, {}) 
 
x = routine_id(f1:s2)       -- namespace qualifier Ok  
? call_func(x, {}) 
 
 
---------------------------- 

[$]: eui bugreport.ex

Version


4.1.0 development (6258:f0054b3a8f8b, 2014-10-01 13:26:40)

Operating System


Platform: Linux, Build: HP-s3733es, 3.17.6-1-lqx:0

Include Directories


1: /home/cargoan 2: /home/cargoan/euphoria-LINUX-4.1.0/include

EUDIR


/home/cargoan/euphoria-LINUX-4.1.0

PATH


/home/cargoan/euphoria-LINUX-4.1.0/bin:/home/cargoan/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

Details

Type: Bug Report Severity: Minor Category: Translator
Assigned To: unknown Status: Accepted Reported Release:
Fixed in SVN #: View VCS: none Milestone:

1. Comment by cargoan Dec 17, 2014

generated core output (gdb):

[$]: LANG=C coredumpctl gdb
           PID: 8247 (euc) 
           UID: 1000 (cargoan) 
           GID: 100 (users) 
        Signal: 11 (SEGV) 
     Timestamp: Wed 2014-12-17 09:22:15 CET (7min ago) 
  Command Line: euc file.ex 
    Executable: /home/cargoan/euphoria-LINUX-4.1.0/bin/euc 
 Control Group: /user.slice/user-1000.slice/session-1.scope 
          Unit: session-1.scope 
         Slice: user-1000.slice 
       Session: 1 
     Owner UID: 1000 (cargoan) 
       Boot ID: ff0b652b2c674118a95152be82752045 
    Machine ID: 152d57909c7bbd9ccefc769e00000770 
      Hostname: HP-s3733es 
      Coredump: /var/lib/systemd/coredump/core.euc.1000.ff0b652b2c674118a95152be82752045.8247.1418804535000000.lz4 
       Message: Process 8247 (euc) of user 1000 dumped core. 
 
GNU gdb (GDB) 7.8.1 
Copyright (C) 2014 Free Software Foundation, Inc. 
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 
This is free software: you are free to change and redistribute it. 
There is NO WARRANTY, to the extent permitted by law.  Type "show copying" 
and "show warranty" for details. 
This GDB was configured as "x86_64-unknown-linux-gnu". 
Type "show configuration" for configuration details. 
For bug reporting instructions, please see: 
<http://www.gnu.org/software/gdb/bugs/>. 
Find the GDB manual and other documentation resources online at: 
<http://www.gnu.org/software/gdb/documentation/>. 
For help, type "help". 
Type "apropos word" to search for commands related to "word"... 
Reading symbols from /home/cargoan/euphoria-LINUX-4.1.0/bin/euc...done. 
[New LWP 8247] 
 
warning: Could not load shared library symbols for linux-vdso.so.1. 
Do you need "set solib-search-path" or "set sysroot"? 
[Thread debugging using libthread_db enabled] 
Using host libthread_db library "/usr/lib/libthread_db.so.1". 
Core was generated by 'euc file.ex'. 
Program terminated with signal SIGSEGV, Segmentation fault. 
#0  0x0000000000548ae2 in _54MarkTargets () 
 
(gdb) run file.ex 
Starting program: /home/cargoan/euphoria-LINUX-4.1.0/bin/euc file.ex 
warning: Could not load shared library symbols for linux-vdso.so.1. 
Do you need "set solib-search-path" or "set sysroot"? 
[Thread debugging using libthread_db enabled] 
Using host libthread_db library "/usr/lib/libthread_db.so.1". 
Build directory: build-259696/ 
 
Program received signal SIGSEGV, Segmentation fault. 
0x0000000000548ae2 in _54MarkTargets () 
 

2. Comment by mattlewis Dec 17, 2014

I can reproduce this. Running the interpreted translator, I get:

symtab.e:653 in function MarkTargets()  
subscript value -9 is out of bounds, reading from a sequence of length 178 - in subscript #1 of 'SymTab' 
... called from emit.e:1282 in procedure emit_op()   
... called from parser.e:1234 in procedure Function_call()   
... called from parser.e:1348 in procedure Factor()   
... called from parser.e:1374 in procedure UFactor()   
... called from parser.e:1383 in function Term()   
... called from parser.e:1398 in function aexpr()   
... called from parser.e:1412 in function cexpr()   
... called from parser.e:1435 in function rexpr()   
... called from parser.e:1474 in procedure Expr()   
... called from parser.e:1697 in procedure Assignment()   
... called from parser.e:3747 in function Global_declaration()   
... called from parser.e:4826 in procedure real_parser()   
... called from parser.e:5035 in procedure parser()   
... called from main.e:201 in procedure main()   
... called from main.e:228  
--> See ex.err 

Search



Quick Links

User menu

Not signed in.

Misc Menu