Skip to content

Symbol alias can not be undefined in a subtraction expression #11364

@ramosian-glider

Description

@ramosian-glider
Bugzilla Link 10992
Version trunk
OS MacOS X
Attachments A minimal reproducer
CC @asl

Extended Description

$ cat globals.bc
; ModuleID = 'globals.cc'
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
target triple = "i386-apple-macosx10.6.8"

@​_ZZL5IdentiE4zero = internal global { i32, [60 x i8] } zeroinitializer, align 32
@​_ZZL5IdentiE4zero_asanRZ = alias internal getelementptr inbounds ({ i32, [60 x i8] }* @​_ZZL5IdentiE4zero, i32 0, i32 0)

define void @​_Z3foov() nounwind ssp {
entry:
%0 = volatile load i8* inttoptr (i32 lshr (i32 ptrtoint (i32* @​_ZZL5IdentiE4zero_asanRZ to i32), i32 3) to i8*)
ret void
}

$ ../clang_build_Darwin/Release+Asserts/bin/clang globals.bc
fatal error: error in backend: symbol '__ZZL5IdentiE4zero_asanRZ' can not be undefined in a subtraction expression

This test case is a reduced output of the AddressSanitizer instrumentation pass (http://code.google.com/p/address-sanitizer), which works perfectly on Linux, so I suspect this to be a bug in Clang on Darwin. If necessary, I can provide a more real-world example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:driver'clang' and 'clang++' user-facing binaries. Not 'clang-cl'

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions