bug-gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #63268] throw|catch behavior: unexpected items at data stack


From: Stephan Rudlof
Subject: [bug #63268] throw|catch behavior: unexpected items at data stack
Date: Mon, 24 Oct 2022 16:49:32 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?63268>

                 Summary: throw|catch behavior: unexpected items at data stack
                 Project: Gforth
               Submitter: hartrock
               Submitted: Mon 24 Oct 2022 08:49:30 PM UTC
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Mon 24 Oct 2022 08:49:30 PM UTC By: Stephan Rudlof <hartrock>
Unclear to me, why there are items left at data stack after executing
_trigger_problem_.

Wrong understanding of throw|catch mechanism, bug, or (what) feature?


sr@rs:~/Gforth$ cat throw_catch_problem.fs
: run-thrower_no-arg ( -- )
    try
        77 throw
    restore
    endtry
    ~~
    ."   just before throw"
    throw
;
: run-thrower_arg ( c-addr u -- )
    2drop
    try
        77 throw
    restore
    endtry
    ~~
    ."   just before throw"
    throw
;

: trigger_problem
    s" arg"
    ~~
    ['] run-thrower_arg catch
    ~~
    ."   after catch: *why* 2 additonal stack items at dstack after catching
err throw here?"
    assert( 77 = )
;
: trigger_problem_not
    ~~
    ['] run-thrower_no-arg catch
    ~~
    ."   after catch: *no* 2 additonal stack items at dstack after catching
err throw here."
    assert( 77 = )
;
sr@rs:~/Gforth$ gforth throw_catch_problem.fs 
Gforth 0.7.9_20221013
Authors: Anton Ertl, Bernd Paysan, Jens Wilke et al., for more type `authors'
Copyright © 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `help' for basic help
trigger_problem_not 
throw_catch_problem.fs:30:5:<0> 

throw_catch_problem.fs:6:5:<1> #77 
  just before throw
throw_catch_problem.fs:32:5:<1> #77 
  after catch: *no* 2 additional stack items at dstack after catching err
throw here. ok
.s <0>  ok
trigger_problem 
throw_catch_problem.fs:23:5:<2> "arg" 

throw_catch_problem.fs:16:5:<1> #77 
  just before throw
throw_catch_problem.fs:25:5:<3> #77 $7F4A0C4D2F28 #77 
  after catch: *why* 2 additional stack items at dstack after catching err
throw here? ok 2
.s <2> 77 139956010692392  ok 2
\ Why?  ok 2








    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63268>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]