Skip to content

[awk] srand return issue? #204

@jgarzik

Description

@jgarzik

The following failure was provided by another awk author.

Working (macos awk):

% awk 'BEGIN {printf "%s ",srand(1099511627776);print rand();print srand()}'
1 0.268992
1099511627776

Failure (our awk):

% RUST_BACKTRACE=1 ./target/release/awk 'BEGIN {printf "%s ",srand(1099511627776);print rand();print srand()}'
thread 'main' panicked at awk/src/interpreter/mod.rs:1067:36:
empty stack
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::option::expect_failed
   3: awk::interpreter::Stack::pop_scalar_value
   4: awk::interpreter::builtin_sprintf
   5: awk::interpreter::call_simple_builtin
   6: awk::interpreter::Interpreter::run_internal
   7: awk::interpreter::Interpreter::run
   8: awk::interpreter::interpret
   9: awk::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions