Dead code elimination fails in iterative fibonacci program #8

Open
opened 2025-08-07 22:22:08 +00:00 by ed · 0 comments
Owner

The following program fails to compile:

main() {
	fib(10)
}

fib(n int) -> int {
	b := 0
	c := 1

	loop 0..n {
		a := b
		b = c
		c = a + b
	}

	return b
}

Error:

tests/fibonacci.q:1:1

    main() {
    ┬
    ╰─ Unused value ''
The following program fails to compile: ``` main() { fib(10) } fib(n int) -> int { b := 0 c := 1 loop 0..n { a := b b = c c = a + b } return b } ``` Error: ``` tests/fibonacci.q:1:1 main() { ┬ ╰─ Unused value '' ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: cli/q#8
No description provided.