@@ -46,7 +46,17 @@ template<> struct ilist_traits<Function>
4646
4747 // createSentinel is used to get hold of the node that marks the end of the
4848 // list... (same trick used here as in ilist_traits<Instruction>)
49- Function *createSentinel () const {
49+ // HLSL Change Starts
50+ // Temporarily disable "downcast of address" UBSAN runtime error
51+ // https://github.com/microsoft/DirectXShaderCompiler/issues/6446
52+ #ifdef __has_feature
53+ #if __has_feature(undefined_behavior_sanitizer)
54+ __attribute__ ((no_sanitize(" undefined" )))
55+ #endif // __has_feature(address_sanitizer)
56+ #endif // defined(__has_feature)
57+ // HLSL Change Ends
58+ Function *
59+ createSentinel () const {
5060 return static_cast <Function*>(&Sentinel);
5161 }
5262 static void destroySentinel (Function*) {}
@@ -62,7 +72,17 @@ template<> struct ilist_traits<Function>
6272template <> struct ilist_traits <GlobalVariable>
6373 : public SymbolTableListTraits<GlobalVariable, Module> {
6474 // createSentinel is used to create a node that marks the end of the list.
65- GlobalVariable *createSentinel () const {
75+ // HLSL Change Starts
76+ // Temporarily disable "downcast of address" UBSAN runtime error
77+ // https://github.com/microsoft/DirectXShaderCompiler/issues/6446
78+ #ifdef __has_feature
79+ #if __has_feature(undefined_behavior_sanitizer)
80+ __attribute__ ((no_sanitize(" undefined" )))
81+ #endif // __has_feature(address_sanitizer)
82+ #endif // defined(__has_feature)
83+ // HLSL Change Ends
84+ GlobalVariable *
85+ createSentinel () const {
6686 return static_cast <GlobalVariable*>(&Sentinel);
6787 }
6888 static void destroySentinel (GlobalVariable*) {}
@@ -77,7 +97,17 @@ template<> struct ilist_traits<GlobalVariable>
7797template <> struct ilist_traits <GlobalAlias>
7898 : public SymbolTableListTraits<GlobalAlias, Module> {
7999 // createSentinel is used to create a node that marks the end of the list.
80- GlobalAlias *createSentinel () const {
100+ // HLSL Change Starts
101+ // Temporarily disable "downcast of address" UBSAN runtime error
102+ // https://github.com/microsoft/DirectXShaderCompiler/issues/6446
103+ #ifdef __has_feature
104+ #if __has_feature(undefined_behavior_sanitizer)
105+ __attribute__ ((no_sanitize(" undefined" )))
106+ #endif // __has_feature(address_sanitizer)
107+ #endif // defined(__has_feature)
108+ // HLSL Change Ends
109+ GlobalAlias *
110+ createSentinel () const {
81111 return static_cast <GlobalAlias*>(&Sentinel);
82112 }
83113 static void destroySentinel (GlobalAlias*) {}
@@ -93,7 +123,17 @@ template<> struct ilist_traits<NamedMDNode>
93123 : public ilist_default_traits<NamedMDNode> {
94124 // createSentinel is used to get hold of a node that marks the end of
95125 // the list...
96- NamedMDNode *createSentinel () const {
126+ // HLSL Change Starts
127+ // Temporarily disable "downcast of address" UBSAN runtime error
128+ // https://github.com/microsoft/DirectXShaderCompiler/issues/6446
129+ #ifdef __has_feature
130+ #if __has_feature(undefined_behavior_sanitizer)
131+ __attribute__ ((no_sanitize(" undefined" )))
132+ #endif // __has_feature(address_sanitizer)
133+ #endif // defined(__has_feature)
134+ // HLSL Change Ends
135+ NamedMDNode *
136+ createSentinel () const {
97137 return static_cast <NamedMDNode*>(&Sentinel);
98138 }
99139 static void destroySentinel (NamedMDNode*) {}
0 commit comments