ugo icon indicating copy to clipboard operation
ugo copied to clipboard

Huge Logical Error

Open Asilvorcarp opened this issue 1 year ago • 0 comments

In compiler.go

			// if.body
			func() {
				defer p.restoreScope(p.scope)
				p.enterScope()

				fmt.Fprintf(w, "\n%s:\n", ifBody)
				if stmt.Else != nil {
					p.compileStmt(w, stmt.Body)
					fmt.Fprintf(w, "\tbr label %%%s\n", ifElse) // here
				} else {
					p.compileStmt(w, stmt.Body)
					fmt.Fprintf(w, "\tbr label %%%s\n", ifEnd)
				}
			}()

the ifElse should be ifEnd !

By the way, I am also curious about why labels ifInit and ifCond are needed, since they are branched to immediately.

Asilvorcarp avatar May 07 '23 23:05 Asilvorcarp