Skip to content

Imprecise error when attempting to use #reverse #unroll with a numeric range #4435

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

Closed
Barinzaya opened this issue Oct 30, 2024 · 5 comments
Closed

Comments

@Barinzaya
Copy link
Contributor

Barinzaya commented Oct 30, 2024

Context

  • Operating System & Odin Version:
	Odin:    dev-2024-10-nightly
	OS:      EndeavourOS, Linux 6.11.5-arch1-1
	CPU:     AMD Ryzen 9 9950X 16-Core Processor
	RAM:     61888 MiB
	Backend: LLVM 18.1.6

Expected Behavior

When attempting to use #reverse #unroll on a loop with a numeric range, the specific error message for #reverse not being supported with ranges should be produced.

Error: #reverse for is not supported with ranges, prefer an explicit for loop with init, condition, and post arguments
        #reverse #unroll for i in 0..<10 { ...
                         ^~~~~~~~~~~~~~~~~ ...

Current Behavior

When attempting to use #reverse #unroll on a loop with a numeric range, the error message indicates that #reverse may only be used on a for in statement, despite apparently preceding one (albeit with an additional #unroll tag).

Syntax Error: #reverse can only be applied to a 'for in' statement
        #reverse #unroll for i in 0..<10 {
        ^

Steps to Reproduce

Attempt to build the following code:

package mre

import "core:fmt"

main :: proc() {
	#reverse #unroll for i in 0..<10 {
		fmt.println(i)
	}
}
@gingerBill
Copy link
Member

#unroll is still kind of a placeholder feature that shouldn't really be used.

@Barinzaya
Copy link
Contributor Author

Is there a permanent alternative planned, aside from hand-unrolling?

@github-actions github-actions bot added the stale label Mar 4, 2025
@Feoramund
Copy link
Contributor

#unroll is still kind of a placeholder feature that shouldn't really be used.

#unroll is in fact not listed on the Odin overview. I was a bit surprised. Granted, it's only ever used for crypto AES and the bytes SIMD procedures in the core libraries.

@laytan
Copy link
Collaborator

laytan commented Jun 2, 2025

At this point #unroll is not a placeholder anymore afaik it's fully implemented now

@Feoramund
Copy link
Contributor

I added #unroll to the overview documentation, so that's sorted.

@Kelimion Kelimion closed this as completed Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants