google / szl

A compiler and runtime for the Sawzall language
Other
69 stars 16 forks source link

Segfault with the attached szl code and failing to provide an input data file. #10

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the command: "src/szl example1.szl"
2.
3.

What is the expected output? What do you see instead?
I am intentionally not providing an input datafile; normally I'd expect a 
syntax error, but instead I get a Segfault.

What version of the product are you using? On what operating system?
I am on Ubuntu 10.04, 32bit, Intel x86

Please provide any additional information below.
1)
The stacktrace is as follows:
#0  0x004b7fd3 in ?? ()
#1  0x00bb54d4 in sawzall::Proc::Execute (this=0x9f44168, max_steps=2147483647, 
num_steps=0x0) at engine/proc.cc:403
#2  0x00bc08fe in sawzall::Process::Execute (this=0xbff18ca0, 
max_steps=2147483647, num_steps=0x0) at engine/sawzall.cc:636
#3  0x00bc1488 in sawzall::Process::Run (this=0xbff18ca0, input_ptr=0x804de94 " 
", input_size=0, key_ptr=0x804de94 " ", key_size=0) at engine/sawzall.cc:669
#4  0x00bc154e in sawzall::Process::RunOrDie (this=0xbff18ca0, 
input_ptr=0x804de94 " ", input_size=0, key_ptr=0x804de94 " ", key_size=0) at 
engine/sawzall.cc:689

2)
BTW, when I generated bytecode instead of native code it works fine. That is:
src/szl example1.szl -native=false
works correctly...

Original issue reported on code.google.com by imran.fa...@gmail.com on 7 Nov 2010 at 10:39

Attachments:

GoogleCodeExporter commented 9 years ago
Imran, I can't reproduce this.  I've got a chroot set up with 32-bit Ubuntu 
10.04 LTS:

$ lsb_release -d
Description:    Ubuntu 10.04 LTS
$ file src/.libs/szl
src/.libs/szl: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
$ src/szl example1.szl
emit _undef_cnt <- 1;
emit _undef_details["example1.szl:5: c != 0 (probably because \"c\" was 
undefined due to an error at example1.szl:4: int(string(fields[1]), 10) (index 
out of bounds (index = 1, array length = 0)))"] <- 1;
Stack trace:
  0. $main: function(input: bytes, input_key: bytes)
     input: bytes = B""
     input_key: bytes = B""
     fields: array of bytes = {  }
     w: string = <undefined>
     c: int = <undefined>

szl: fatal: undefined value at example1.szl:5: c != 0 (probably because "c" was 
undefined due to an error at example1.szl:4: int(string(fields[1]), 10) (index 
out of bounds (index = 1, array length = 0)))

Can you provide some additional info?  E.g. compiler version, library versions, 
etc.  Thanks.

Original comment by dbh@google.com on 14 Nov 2010 at 10:39

GoogleCodeExporter commented 9 years ago
$ lsb_release -d
Description:    Ubuntu 10.04 LTS

$file src/.libs/szl
src/.libs/szl: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped

$ldd src/.libs/szl
        linux-gate.so.1 =>  (0x00d28000)
        libszl.so.0 => /opt/szl/lib/libszl.so.0 (0x005e5000)
        libszlemitters.so.0 => /opt/szl/lib/libszlemitters.so.0 (0x0041a000)
        libszlintrinsics.so.0 => /opt/szl/lib/libszlintrinsics.so.0 (0x00f60000)
        libprotoc.so.6 => /usr/local/lib/libprotoc.so.6 (0x00110000)
        libprotobuf.so.6 => /usr/local/lib/libprotobuf.so.6 (0x001b2000)
        libicui18n.so.42 => /usr/lib/libicui18n.so.42 (0x00a20000)
        libicuuc.so.42 => /usr/lib/libicuuc.so.42 (0x0028f000)
        libcrypto.so.0.9.8 => /lib/i686/cmov/libcrypto.so.0.9.8 (0x00457000)
        libpcre.so.3 => /lib/libpcre.so.3 (0x00c77000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00744000)
        libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x003d3000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x008af000)
        libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0x00cbc000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00d29000)
        libz.so.1 => /lib/libz.so.1 (0x003f9000)
        libicudata.so.42 => /usr/lib/libicudata.so.42 (0xb67ff000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x0040e000)
        /lib/ld-linux.so.2 (0x00bf5000)

Libraries:
Protocol buffers: 2.3.0
libicu-dev: 4.2.1-3
libpcre3-dev: 7.8-3build1

Compilers:
gcc: 4.3
g++: 4.3

Hope that helps. BTW, once again, let me point out that this only occurs when I 
generate native code (-native=false works fine).

Original comment by imran.fa...@gmail.com on 22 Nov 2010 at 9:13