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

Incorrect debug info generation for bitfields. #4243

Closed
flysand7 opened this issue Sep 14, 2024 · 0 comments
Closed

Incorrect debug info generation for bitfields. #4243

flysand7 opened this issue Sep 14, 2024 · 0 comments

Comments

@flysand7
Copy link
Contributor

Context

  • Odin: dev-2024-09:d2d202673
  • OS: Windows 10 Unknown Edition (00000064) (version: 22H2), build 19045.4780
  • CPU: 12th Gen Intel(R) Core(TM) i5-12500H
  • RAM: 16088 MiB
  • Backend: LLVM 18.1.8

Reproduction

  1. Compile the following code with -o:none and -debug.
package bug

import "core:fmt"

main :: proc() {
    ModRM_Byte :: bit_field u8 {
        rm:  u8 | 3,
        rx:  u8 | 3,
        mod: u8 | 2,
    }
    
    b := u8(0b01010011) // mod=1, rx=2, rm=3
    modrm := (cast(^ModRM_Byte) &b)^
    fmt.printfln("%v", modrm)
    a := 3 // breakpoint here
}
  1. Run the program under a debugger
  2. In a debugger, put the breakpoint on the last line of the main function. In the console of the executable it should print ModRM_Byte{rm = 3, rx = 2, mod = 1}.
  3. Put the variable modrm in a watch window and expand the fields. The following results will are obtained:
  • RemedyBG:

image

  • Visual Studio:

image

Bug

The values in the watch video do not match the printed values, which suggests incorrect generation of the debug format. Moreover it's been reported that this does not occur on other platforms, so it seems to be a windows-only bug.

@laytan laytan closed this as completed in d03d9e4 Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant