[PATCH] D151587: [clang][ConstantEmitter] have tryEmitPrivateForVarInit try ConstExprEmitter fast-path first

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 6 08:14:17 PDT 2023


ahatanak added a comment.

In D151587#4397499 <https://reviews.llvm.org/D151587#4397499>, @nickdesaulniers wrote:

> In D151587#4397446 <https://reviews.llvm.org/D151587#4397446>, @efriedma wrote:
>
>> The following also crashes, with no MaterializeTemporaryExpr involved.
>>
>>   struct X {
>>     short n;
>>     char c;
>>   };
>>   
>>   struct Y {
>>     _Atomic(X) a;
>>     _Atomic(int) b;
>>   };
>>   constexpr X x{};
>>   int z;
>>   Y y = { x, z };
>
> Yeah, but not because of this patch; that's a pre-existing issue.

Is there a github issue for this crash? Is anyone looking into this? The following code crashes too:

  typedef union {
    unsigned int f0;
  } Union0;
  
  typedef struct {
    _Atomic(Union0) f1;
  } Struct0;
  
  Struct0 g = {};

It looks like there is a bug here: https://github.com/llvm/llvm-project/blob/main/clang/lib/AST/ExprConstant.cpp#L15066

`Value` is being discarded after the call to `EvaluateAtomic`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151587/new/

https://reviews.llvm.org/D151587



More information about the cfe-commits mailing list