Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix returning a constant #40

Open
mariari opened this issue Sep 5, 2022 · 0 comments
Open

Fix returning a constant #40

mariari opened this issue Sep 5, 2022 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mariari
Copy link
Member

mariari commented Sep 5, 2022

When writing the imperative example, I noticed a bug

(defcircuit imperative-example ((output int))
  (let ((accumulator 0))
    (loop for i from 0 to 9
          do (setf accumulator (+ i accumulator)))
    0))

If we return an explicit number

we get an error

The value
  0
is not of type
  SYMBOL
when binding PASS::SYMB
   [Condition of type TYPE-ERROR]

Restarts:
 0: [RETRY] Retry SLY mREPL evaluation request.
 1: [*ABORT] Return to SLY's top level.
 2: [ABORT] abort thread (#<THREAD "sly-channel-1-mrepl-remote-1" RUNNING {1001BB8073}>)

Backtrace:
 0: (PASS::RENAMING-SCHEME 0) [external]
 1: (PASS:RENAME-PRIMITIVE-CIRCUIT #<ALU.IR.PRIMITIVE-GLOBAL:PRIM-CIRCUIT IMPERATIVE-EXAMPLE -> 0 = ..)
 2: (ALU.PIPELINE.PIPELINE:TO-VAMPIR Circuit IMPERATIVE-EXAMPLE = ..)
 3: (ALU.PIPELINE.PIPELINE:PIPELINE Circuit IMPERATIVE-EXAMPLE = ..)
 4: (SB-INT:SIMPLE-EVAL-IN-LEXENV (VAMPIR IMPERATIVE-EXAMPLE) #<NULL-LEXENV>)
 5: (EVAL (VAMPIR IMPERATIVE-EXAMPLE))

; Returning var 0 of frame 1
#<ALU.IR.PRIMITIVE-GLOBAL:PRIM-CIRCUIT IMPERATIVE-EXAMPLE -> 0 =
(#<LET G1441 = #<#<REFERENCE +> 0 0>>
 #<LET G1442 = #<#<REFERENCE +> 1 #<REFERENCE G1441>>>
 #<LET G1443 = #<#<REFERENCE +> 2 #<REFERENCE G1442>>>
 #<LET G1444 = #<#<REFERENCE +> 3 #<REFERENCE G1443>>>
 #<LET G1445 = #<#<REFERENCE +> 4 #<REFERENCE G1444>>>
 #<LET G1446 = #<#<REFERENCE +> 5 #<REFERENCE G1445>>>
 #<LET G1447 = #<#<REFERENCE +> 6 #<REFERENCE G1446>>>
 #<LET G1448 = #<#<REFERENCE +> 7 #<REFERENCE G1447>>>
 #<LET G1449 = #<#<REFERENCE +> 8 #<REFERENCE G1448>>>
 #<LET G1450 = #<#<REFERENCE +> 9 #<REFERENCE G1449>>> #<STANDALONE-RET 0>) : (0)>

It seems the 0 doesn't get renamed for some reason, should be an easy fix

@mariari mariari added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant