[PATCH] D76096: [clang] allow const structs/unions/arrays to be constant expressions for C
    Nick Desaulniers via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Fri Jul 21 15:37:10 PDT 2023
    
    
  
nickdesaulniers added a comment.
In D76096#4524092 <https://reviews.llvm.org/D76096#4524092>, @nickdesaulniers wrote:
> In D76096#4524003 <https://reviews.llvm.org/D76096#4524003>, @efriedma wrote:
>
>> The ones most likely to be a concern are InitListExpr and StringLiteral.
>
> Here's a reduced instance from the Linux kernel:
>
>   struct timespec64 {
>     long tv_sec;
>     long tv_nsec;
>   } do_utime_mtime;
>   void __attribute__do_utime() { struct timespec64 t[] = {{}, do_utime_mtime}; }
>
> Trace: https://paste.debian.net/1286590/
IIUC what's going wrong here, I think that ConstExprEmitter is //not// able to evaluate the InitListExpr, and is bailing/falling back to call Expr::EvaluateAsRValue().
Is the idea for the way forward here to ensure (i.e. adding code such) that ConstExprEmitter //can// constant evaluate such Expr's?
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76096/new/
https://reviews.llvm.org/D76096
    
    
More information about the cfe-commits
mailing list