Skip to content

@(disabled=!ODIN_DEBUG) doesn't work if procedure called using @(deferred_*=foo_debug) #5083

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
Kelimion opened this issue Apr 27, 2025 · 0 comments · Fixed by #5183
Closed
Labels
bug replicated We were able to replicate the bug.

Comments

@Kelimion
Copy link
Member

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System & Odin Version:
  • Please paste odin report output:

Odin: dev-2025-04:d463aba7d
OS: Ubuntu 24.04.2 LTS, Linux 6.8.0-58-generic
CPU: Intel(R) Core(TM) i7-4790S CPU @ 3.20GHz
RAM: 15901 MiB
Backend: LLVM 20.1.4

Expected Behavior

Expect foo_debug to be disabled on debug builds even if called via a deferred_* attribute instead of directly.

Current Behavior

Direct calls are disabled correctly, deferred call runs as normal

Steps to Reproduce

Compile with and without -debug.
debug_check prints twice for -debug, once otherwise (because called directly). Expected

package main

import "core:fmt"

@(disabled=!ODIN_DEBUG)
debug_check :: proc () {
	fmt.printfln("The code is safe. DEBUG: %v.", ODIN_DEBUG)
}

@(deferred_in=debug_check)
foreign_routine :: proc () {
	fmt.printfln("Running evil code. DEBUG: %v.", ODIN_DEBUG)
}

main :: proc () {
	foreign_routine()
}
Running evil code. DEBUG: false. // Expected
The code is safe. DEBUG: false.  // This shouldn't have printed

Running evil code. DEBUG: true. // Expected
The code is safe. DEBUG: true.  // Expected

Failure Logs

Please include any relevant log snippets or files here.

@Kelimion Kelimion added bug replicated We were able to replicate the bug. labels Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug replicated We were able to replicate the bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant