-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Missing debug information for constant read #11416
Comments
This is a regression introduced in #10934. /cc @HertzDevil |
Found another related bug, also introduced by #10934. $ crystal build --debug samples/llvm/brainfuck.cr
Module validation failed: !dbg attachment points at wrong subprogram for function
!2261 = distinct !DISubprogram(name: "__crystal_main", linkageName: "__crystal_main", scope: !2262, file: !2262, type: !2263, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !2266)
void (i32, i8**)* @__crystal_main
%56 = load %"Array(String)"*, %"Array(String)"** @ARGV, !dbg !2718
!2718 = !DILocation(line: 5, column: 19, scope: !2719)
!2719 = distinct !DISubprogram(name: "~LLVM::initialized:init", linkageName: "~LLVM::initialized:init", scope: !2720, file: !2720, line: 5, type: !2263, scopeLine: 5, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !2347)
!2719 = distinct !DISubprogram(name: "~LLVM::initialized:init", linkageName: "~LLVM::initialized:init", scope: !2720, file: !2720, line: 5, type: !2263, scopeLine: 5, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !2347) |
Are reading constants and reading class vars the only locations where #10934 could've introduced a bug? I think so, but I'm not sure. Let's not miss something. What about external vars? Or any of the reads inside pointerof? I'm also wondering why the missing debug locations don't show up more often. Stdlib is full of FOO = IO::FileDescriptor.from_stdio(2)
FOO.puts "foo" |
The constant needs to be read before it is assigned, otherwise no lazy initialization is done. Presumably something in the prelude uses If this indeed happens only at the top-level scope then class variable read calls cannot fail because they are no top-level class variables. |
No, I mean the constant read happens in main scope. This code doesn't error: def foo
STDOUT.puts "false"
end
foo Adding a read to |
Latest 1.2.1
A simple source
Another error with
--debug
And it was the same with
crystal 1.2.0 [9f90efe33] (2021-10-13)
Originally posted by @Val in #11385 (comment)
The text was updated successfully, but these errors were encountered: