[llvm] r322862 - [ADT] Just give up on GCC, I can't fix this.

Friedman, Eli via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 15:21:20 PST 2018


Sure, the memory layout is the same, but the clang version isn't 
"non-trivial for the purposes of calls" (per the Itanium C++ ABI).

-Eli

On 1/24/2018 3:02 PM, Benjamin Kramer wrote:
> I believe GCC vs. Clang should be fine because both versions have the
> same memory layout.
>
> On Wed, Jan 24, 2018 at 11:56 PM, Friedman, Eli <efriedma at codeaurora.org> wrote:
>> On 1/18/2018 8:23 AM, Benjamin Kramer via llvm-commits wrote:
>>> Modified: llvm/trunk/include/llvm/ADT/Optional.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Optional.h?rev=322862&r1=322861&r2=322862&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/include/llvm/ADT/Optional.h (original)
>>> +++ llvm/trunk/include/llvm/ADT/Optional.h Thu Jan 18 08:23:40 2018
>>> @@ -23,7 +23,6 @@
>>>    #include <algorithm>
>>>    #include <cassert>
>>>    #include <new>
>>> -#include <cstring>
>>>    #include <utility>
>>>      namespace llvm {
>>> @@ -111,6 +110,7 @@ template <typename T, bool IsPodLike> st
>>>      }
>>>    };
>>>    +#if !defined(__GNUC__) || defined(__clang__) // GCC up to GCC7
>>> miscompiles this.
>>>    /// Storage for trivially copyable types only.
>>>    template <typename T> struct OptionalStorage<T, true> {
>>>      AlignedCharArrayUnion<T> storage;
>>
>> Could this cause an ABI problem if you mix code built with clang and gcc?
>>
>> -Eli
>>
>> --
>> Employee of Qualcomm Innovation Center, Inc.
>> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
>> Foundation Collaborative Project
>>

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project



More information about the llvm-commits mailing list