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

Bad debug line info on switch #2255

Open
JohanEngelen opened this Issue Jul 31, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@JohanEngelen
Copy link
Member

JohanEngelen commented Jul 31, 2017

Note the wrong debug line info on the switch's expression i+666. It says line 6, instead of line 2.

int foo(int i) {
    switch (i+666) {  // line 2
        case 10:
            return 42;
        default:
            return 5;   // line 6
    }
}
; [#uses = 0] [display name = switchdebug.foo]
; Function Attrs: uwtable
define i32 @_D11switchdebug3fooFiZi(i32 %i_arg) #0 !dbg !5 {
  %i = alloca i32, align 4                        ; [#uses = 2, size/byte = 4]
  store i32 %i_arg, i32* %i, !dbg !11             ; [debug line = 1:5]
  call void @llvm.dbg.declare(metadata i32* %i, metadata !10, metadata !12), !dbg !11 ; [debug line = 1:5] [debug variable = i]
  %1 = load i32, i32* %i, !dbg !13                ; [#uses = 1] [debug line = 6:13]
  %2 = add i32 %1, 666, !dbg !13                  ; [#uses = 1] [debug line = 6:13]
  switch i32 %2, label %defaultcntr [
    i32 10, label %casecntr
  ]
...
@JohanEngelen

This comment has been minimized.

Copy link
Member Author

JohanEngelen commented Dec 23, 2018

This is closely related to #2090

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.