Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#451 closed defect (fixed)

Unexpected warning using define-values at toplevel.

Reported by: Alan Post Owned by: felix winkelmann
Priority: minor Milestone: 4.9.0
Component: compiler Version: 4.6.x
Keywords: Cc: alanpost@…
Estimated difficulty:

Description

The following program:

(define-values (foo bar)
  (values
    (lambda () 0)
    (lambda () 1)))

When compiled with 'csc -d2 -o define-values define-values.scm'

Gives the following warning:

Note: local assignment to unused variable `foo' may be unintended

Note: local assignment to unused variable `bar' may be unintended

I would expect to get no warning in this case, and instead have two top-level definitions, 'foo' and 'bar' after calling define-values.

This warning only happens with '-d2'.

Change History (6)

comment:1 Changed 9 years ago by Alan Post

Cc: alanpost@… added

comment:2 Changed 9 years ago by felix winkelmann

Owner: set to felix winkelmann
Priority: not urgent at allminor
Status: newassigned

This is admittedly somewhat confusing. I will try to detect this case or remove the warning.

comment:3 in reply to:  2 ; Changed 9 years ago by Alan Post

Replying to felix:

This is admittedly somewhat confusing. I will try to detect this case or remove the warning.

Does this warning suggest I shouldn't be using '(declare (safe-globals))' or any other optimization where I assert I'm not changing the value of my top-level module bindings?

I understand what is happening behind the scenes to make define-values work. I use it several times in genturfa'i to share a lexical environment between two or more top-level definitions, and that means they aren't *really* top-level bindings as far as the environment is concerned.

I really only care about the details when they interact with the optimizer, however. Will you comment on that as it regards this warning an any (declare ...) flags I might be using?

comment:4 in reply to:  3 Changed 9 years ago by felix winkelmann

Resolution: fixed
Status: assignedclosed

Replying to alanpost:

Replying to felix:

This is admittedly somewhat confusing. I will try to detect this case or remove the warning.

Does this warning suggest I shouldn't be using '(declare (safe-globals))' or any other optimization where I assert I'm not changing the value of my top-level module bindings?

No, it has nothing to do with this.

I really only care about the details when they interact with the optimizer, however. Will you comment on that as it regards this warning an any (declare ...) flags I might be using?

Nevermind the warning, I have removed it for this case.

comment:5 Changed 9 years ago by felix winkelmann

Milestone: 4.7.04.8.0

Milestone 4.7.0 deleted

comment:6 Changed 7 years ago by felix winkelmann

Milestone: 4.8.04.9.0

Milestone 4.8.0 deleted

Note: See TracTickets for help on using tickets.