unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* [bug #32340] non-local exit may cause wrong-type-arg error
@ 2011-02-03 14:48 Mike Gran
  2011-02-10  9:43 ` Andy Wingo
  2011-03-30 21:32 ` Andy Wingo
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Gran @ 2011-02-03 14:48 UTC (permalink / raw)
  To: Mike Gran, bug-guile


URL:
  <http://savannah.gnu.org/bugs/?32340>

                 Summary: non-local exit may cause wrong-type-arg error
                 Project: Guile
            Submitted by: mike121
            Submitted on: Thu 03 Feb 2011 02:48:55 PM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Hi-

Sometimes on a non-local exit can cause a wrong-type-arg error to be emitted.
 This may be associated with GUILE_AUTO_COMPILE=0.  It is a mandelbug, so I
don't have a way to replicate it consistently, yet.

Here is one example.

guile: uncaught throw to wrong-type-arg: (#f Wrong type (expecting ~A): ~S
(exact integer (#t #<catch-closure 318bca0> #<catch-closure 318bc80>
#<catch-closure 318bc60>)) ((#t #<catch-closure 318bca0> #<catch-closure
318bc80> #<catch-closure 318bc60>)))

Looking at the C backtrace, the error is a non-integer getting passed to
scm_to_size_t in scm_i_prompt_pop_abort_args_x.

The line in question is

63	  n = scm_to_size_t (SCM_PROMPT_REGISTERS (prompt)->sp[0]);

If I scm_write the value that is getting passed to scm_to_size_t, I get the
expression

  ((@ (ice-9 control) %) (begin (load-user-init) ((@ (ice-9 top-repl)
top-repl))))

which is clearly not an integer.  ;-)

Nine levels up in the C stack is a scm_c_primitive_eval, which is evaluating
  
#<tree-il (apply (@@ (ice-9 control) call-with-prompt) (apply (@@ (ice-9
control) default-prompt-tag)) (lambda () (lambda-case ((() #f #f #f () ())
(begin (apply (toplevel load-user-init)) (apply (@ (ice-9 top-repl)
top-repl)))))) (@@ (ice-9 control) default-prompt-handler))>

Here is the C stack  

#0  scm_error_scm (key=0x766320, subr=0x4, message=0xafb0c20, args=0xaaf2290,

    data=0xaaf22b0) at error.c:94
#1  0x00007ffff7c95ac1 in scm_error (key=0x766320, subr=0x0, 
    message=0x7ffff7d78617 "Wrong type (expecting ~A): ~S", args=0xaaf2290, 
    rest=0xaaf22b0) at error.c:61
#2  0x00007ffff7c95fe6 in scm_wrong_type_arg_msg (subr=0x0, pos=0, 
    bad_value=0xb14b40, szMessage=0x7ffff7d85130 "exact integer")
    at error.c:287
#3  0x00007ffff7cdecee in scm_to_uint64 (val=0xb14b40)
    at ../libguile/conv-uinteger.i.c:90
#4  0x00007ffff7c8df25 in scm_i_prompt_pop_abort_args_x (prompt=0xafaaa80)
    at control.c:63
#5  0x00007ffff7c97e99 in eval (x=0x869750, env=0xaaf0150) at eval.c:424
#6  0x00007ffff7c971be in eval (x=0x6534080, env=0x565ec80) at eval.c:223
#7  0x00007ffff7c9743b in eval (x=0x885940, env=0x19c31e0) at eval.c:247
#8  0x00007ffff7c97ec2 in eval (x=0x869750, env=0x653a610) at eval.c:428
#9  0x00007ffff7c98d27 in scm_c_primitive_eval (exp=0x98065a0) at eval.c:728
#10 0x00007ffff7d46875 in vm_debug_engine (vm=0x7b2d40, program=0x7b9340, 
    argv=0x7fffffffbbb0, nargs=1) at vm-i-system.c:874
#11 0x00007ffff7d56908 in scm_c_vm_run (vm=0x7b2d40, program=0x7b9340, 
    argv=0x7fffffffbba8, nargs=1) at vm.c:565
#12 0x00007ffff7c98d61 in scm_primitive_eval (exp=0xb14b40) at eval.c:735
...

If I coerce a Scheme backtrace out of it, I get

Backtrace:
In unknown file:
   ?: 4 [boot-closure #t #<catch-closure 318bca0> ...]
   ?: 3 [catch-closure]
   ?: 2 [primitive-eval {((@ (ice-9 control) %) (begin (load-user-init)
(#)))}]
   ?: 1 [boot-closure wrong-type-arg #f ...]
   ?: 0 [catch-closure wrong-type-arg #f ...]





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?32340>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug #32340] non-local exit may cause wrong-type-arg error
  2011-02-03 14:48 [bug #32340] non-local exit may cause wrong-type-arg error Mike Gran
@ 2011-02-10  9:43 ` Andy Wingo
  2011-03-30 21:32 ` Andy Wingo
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2011-02-10  9:43 UTC (permalink / raw)
  To: Mike Gran; +Cc: bug-guile

On Thu 03 Feb 2011 15:48, Mike Gran <INVALID.NOREPLY@gnu.org> writes:

> Sometimes on a non-local exit can cause a wrong-type-arg error to be emitted.
>  This may be associated with GUILE_AUTO_COMPILE=0.  It is a mandelbug, so I
> don't have a way to replicate it consistently, yet.

It might be that the SCM_M_PROMPT case in eval.c:eval was not declaring
some needed locals as volatile.  Just a guess.  I put in a patch to
git.  Let me know if you can reproduce this again.

Also, if this happens again, I would be interested in a backtrace from
the abort as well as from the prompt.

Cheers,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug #32340] non-local exit may cause wrong-type-arg error
  2011-02-03 14:48 [bug #32340] non-local exit may cause wrong-type-arg error Mike Gran
  2011-02-10  9:43 ` Andy Wingo
@ 2011-03-30 21:32 ` Andy Wingo
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2011-03-30 21:32 UTC (permalink / raw)
  To: Andy Wingo, Mike Gran, bug-guile

Update of bug #32340 (project guile):

                  Status:                    None => Fixed                  
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

Fixed in 572eef50c2d902d34427945dd504ba03af666e48.  Thanks for the report!

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?32340>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-30 21:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-03 14:48 [bug #32340] non-local exit may cause wrong-type-arg error Mike Gran
2011-02-10  9:43 ` Andy Wingo
2011-03-30 21:32 ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).