Displaying 3 results from an estimated 3 matches for "dtu1".
Did you mean:
dpu1
2011 Nov 02
0
[LLVMdev] weak_odr constant versus weak_odr global
...ename T> const int U<T>::k = T::x;
>
> #ifdef TU1
> extern int f();
> const int S::x = 42;
> int main() { return f() + U<S>::k; }
> #endif
>
> #ifdef TU2
> int f() { return U<S>::k; }
> #endif
>
> /* Steps to repro:
>
> clang repro.cpp -DTU1 -c -o tu1.o
> clang repro.cpp -DTU2 -c -o tu2.o
> clang tu1.o tu2.o
> ./a.out
>
> */
>
> This segfaults, because... in TU1, we get:
>
> @_ZN1UI1SE1kE = weak_odr constant i32 42, align 4
>
> and in TU2, we get:
>
> @_ZN1UI1SE1kE = weak_odr global i32 0, align 4...
2011 Nov 01
6
[LLVMdev] weak_odr constant versus weak_odr global
...pename T> struct U {
static const int k;
};
template<typename T> const int U<T>::k = T::x;
#ifdef TU1
extern int f();
const int S::x = 42;
int main() {
return f() + U<S>::k;
}
#endif
#ifdef TU2
int f() { return U<S>::k; }
#endif
/* Steps to repro:
clang repro.cpp -DTU1 -c -o tu1.o
clang repro.cpp -DTU2 -c -o tu2.o
clang tu1.o tu2.o
./a.out
*/
This segfaults, because... in TU1, we get:
@_ZN1UI1SE1kE = weak_odr constant i32 42, align 4
and in TU2, we get:
@_ZN1UI1SE1kE = weak_odr global i32 0, align 4
plus a global constructor which writes to @_ZN1UI1SE1k...
2011 Nov 02
1
[LLVMdev] [cfe-dev] weak_odr constant versus weak_odr global
...;> #ifdef TU1
>> extern int f();
>> const int S::x = 42;
>> int main() { return f() + U<S>::k; }
>> #endif
>>
>> #ifdef TU2
>> int f() { return U<S>::k; }
>> #endif
>>
>> /* Steps to repro:
>>
>> clang repro.cpp -DTU1 -c -o tu1.o
>> clang repro.cpp -DTU2 -c -o tu2.o
>> clang tu1.o tu2.o
>> ./a.out
>>
>> */
>>
>> This segfaults, because... in TU1, we get:
>>
>> @_ZN1UI1SE1kE = weak_odr constant i32 42, align 4
>>
>> and in TU2, we get:
>>
>...