Skip to content

Commit

Permalink
Workaround buggy offset debug info values (#7335)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcardiff authored Jan 24, 2019
1 parent a590f3d commit 30f7c70
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/compiler/crystal/codegen/debug.cr
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ module Crystal
if (ivar_type = ivar.type?) && (ivar_debug_type = get_debug_type(ivar_type))
offset = @program.target_machine.data_layout.offset_of_element(struct_type, idx &+ (type.struct? ? 0 : 1))
size = @program.target_machine.data_layout.size_in_bits(llvm_embedded_type(ivar_type))

# FIXME structs like LibC::PthreadMutexT generate huge offset values
next if offset > UInt64::MAX / 8u64

member = di_builder.create_member_type(nil, name[1..-1], nil, 1, size, size, 8u64 * offset, LLVM::DIFlags::Zero, ivar_debug_type)
element_types << member
end
Expand Down

0 comments on commit 30f7c70

Please sign in to comment.