Skip to main content
added 283 characters in body
Source Link

ANS Forth:

0 >in 2dup ! !

which leads to:

$ gforth
Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
0 >in 2dup ! !                                          
:1: Stack overflow
0 >in 2dup >>>!<<< !
Backtrace:
$B71DF6EC r> 
$B71D34A4 perform 
$B71DD654 (search-wordlist) 
$3 
$0 
$B71DD734 (vocfind) 
$B71D34A4 perform 
$B71D351C (search-wordlist) 
$B71D3FF4 find-name 

In fact, the 2nd ! is never executed.

>in is an integer variable that contains the current position within the input line, the program attempts to write zero to >in two times, but after the first write (!) the input pointer is reset to the start of input line, and the 2nd pair of values is left on the stack...

ANS Forth:

0 >in 2dup ! !

which leads to:

$ gforth
Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
0 >in 2dup ! !                                          
:1: Stack overflow
0 >in 2dup >>>!<<< !
Backtrace:
$B71DF6EC r> 
$B71D34A4 perform 
$B71DD654 (search-wordlist) 
$3 
$0 
$B71DD734 (vocfind) 
$B71D34A4 perform 
$B71D351C (search-wordlist) 
$B71D3FF4 find-name 

In fact, the 2nd ! is never executed.

ANS Forth:

0 >in 2dup ! !

which leads to:

$ gforth
Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
0 >in 2dup ! !                                          
:1: Stack overflow
0 >in 2dup >>>!<<< !
Backtrace:
$B71DF6EC r> 
$B71D34A4 perform 
$B71DD654 (search-wordlist) 
$3 
$0 
$B71DD734 (vocfind) 
$B71D34A4 perform 
$B71D351C (search-wordlist) 
$B71D3FF4 find-name 

In fact, the 2nd ! is never executed.

>in is an integer variable that contains the current position within the input line, the program attempts to write zero to >in two times, but after the first write (!) the input pointer is reset to the start of input line, and the 2nd pair of values is left on the stack...

Source Link

ANS Forth:

0 >in 2dup ! !

which leads to:

$ gforth
Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
0 >in 2dup ! !                                          
:1: Stack overflow
0 >in 2dup >>>!<<< !
Backtrace:
$B71DF6EC r> 
$B71D34A4 perform 
$B71DD654 (search-wordlist) 
$3 
$0 
$B71DD734 (vocfind) 
$B71D34A4 perform 
$B71D351C (search-wordlist) 
$B71D3FF4 find-name 

In fact, the 2nd ! is never executed.