[libcxx-commits] [PATCH] D111509: [clang] use getCommonSugar in an assortment of places

Artem Belevich via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 8 11:56:25 PDT 2022


tra added a comment.

It appears that this change may result in clang crashing (e.g. it broke CUDA compilation: https://lab.llvm.org/buildbot/#/builders/55/builds/35047/steps/3/logs/stdio).

Reproducer:

  class {
    typedef __complex__ a;
    operator=(double b){c *= b} a c



  $bin/clang++ -cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -std=c++14 -disable-llvm-passes -x c++ reproducer.cc
  reproducer.cc:2:11: warning: plain '_Complex' requires a type specifier; assuming '_Complex double'
    typedef __complex__ a;
            ^
                        double
  reproducer.cc:3:3: error: a type specifier is required for all declarations
    operator=(double b){c *= b} a c
    ^
  reproducer.cc:3:34: error: expected ';' at end of declaration list
    operator=(double b){c *= b} a c
                                   ^
                                   ;
  reproducer.cc:4:1: error: expected '}'
  ^
  reproducer.cc:1:7: note: to match this '{'
  class {
        ^
  clang++: work/llvm/repo/llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From &) [To = clang::BuiltinType, From = clang::QualType]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
  PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
  Stack dump:
  0.      Program arguments: bin/clang++ -cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -std=c++14 -disable-llvm-passes -x c++ reproducer.cc
  1.      reproducer.cc:3:29: current parser token '}'
  2.      reproducer.cc:1:1: parsing struct/union/class body '(anonymous)'
  3.      reproducer.cc:3:22: parsing function body '(anonymous class)::operator='
  4.      reproducer.cc:3:22: in compound statement ('{}')
   #0 0x000055ad5d7fe49a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) work/llvm/repo/llvm/lib/Support/Unix/Signals.inc:569:11
   #1 0x000055ad5d7fe64b PrintStackTraceSignalHandler(void*) work/llvm/repo/llvm/lib/Support/Unix/Signals.inc:636:1
   #2 0x000055ad5d7fcc96 llvm::sys::RunSignalHandlers() work/llvm/repo/llvm/lib/Support/Signals.cpp:103:5
   #3 0x000055ad5d7fed75 SignalHandler(int) work/llvm/repo/llvm/lib/Support/Unix/Signals.inc:407:1
   #4 0x00007f4b4e083200 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12200)
   #5 0x00007f4b4daf28c1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:50:1
   #6 0x00007f4b4dadc546 abort ./stdlib/abort.c:81:7
   #7 0x00007f4b4dadc42f get_sysdep_segment_value ./intl/loadmsgcat.c:509:8
   #8 0x00007f4b4dadc42f _nl_load_domain ./intl/loadmsgcat.c:970:34
   #9 0x00007f4b4daeb242 (/lib/x86_64-linux-gnu/libc.so.6+0x31242)
  #10 0x000055ad5e2f39e8 decltype(auto) llvm::cast<clang::BuiltinType, clang::QualType>(clang::QualType const&) work/llvm/repo/llvm/include/llvm/Support/Casting.h:567:43
  #11 0x000055ad5e2f3929 clang::BuiltinType const* clang::Type::castAs<clang::BuiltinType>() const work/llvm/build/debug/tools/clang/include/clang/AST/TypeNodes.inc:86:1
  #12 0x000055ad62cfe279 clang::ASTContext::getFloatTypeSemantics(clang::QualType) const work/llvm/repo/clang/lib/AST/ASTContext.cpp:1707:14
  #13 0x000055ad61e8ad61 unsupportedTypeConversion(clang::Sema const&, clang::QualType, clang::QualType) work/llvm/repo/clang/lib/Sema/SemaExpr.cpp:1256:29
  #14 0x000055ad61eb3961 clang::Sema::CheckAssignmentConstraints(clang::QualType, clang::ActionResult<clang::Expr*, true>&, clang::CastKind&, bool) work/llvm/repo/clang/lib/Sema/SemaExpr.cpp:9619:7
  #15 0x000055ad61eb30c5 clang::Sema::CheckAssignmentConstraints(clang::SourceLocation, clang::QualType, clang::QualType) work/llvm/repo/clang/lib/Sema/SemaExpr.cpp:9465:3
  #16 0x000055ad61ec565f clang::Sema::CheckAssignmentOperands(clang::Expr*, clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation, clang::QualType, clang::BinaryOperatorKind) work/llvm/repo/clang/lib/Sema/SemaExpr.cpp:13919:12
  #17 0x000055ad61ea1903 clang::Sema::CreateBuiltinBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) work/llvm/repo/clang/lib/Sema/SemaExpr.cpp:14988:11
  #18 0x000055ad61ecaf02 clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) work/llvm/repo/clang/lib/Sema/SemaExpr.cpp:15511:10
  #19 0x000055ad61e8a180 clang::Sema::ActOnBinOp(clang::Scope*, clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*) work/llvm/repo/clang/lib/Sema/SemaExpr.cpp:15323:10
   


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111509



More information about the libcxx-commits mailing list