[llvm-bugs] [Bug 41768] OpenMP default(none) - std::cerr is not diagnosed as "not specified in enclosing 'parallel'", unlike GCC

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 9 03:47:56 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41768

Roman Lebedev <lebedev.ri at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jdoerfert at anl.gov
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #1 from Roman Lebedev <lebedev.ri at gmail.com> ---
... and i had to revert this & the other commit. Sorry :(
This has introduced (exposed?) a crash in clang sema.
The reduced testcase is A Mess, but this is what
clang/utils/creduce-clang-crash.py
gave me :/ I've included the original clang reproducer .cpp + .sh in tarball.

struct a {
 constexpr int b = ;
}
template < bool > struct c
 template < typename d, typename e >
 bool operator<(
     d, e  
  ;
 class f  {
 int cbegin  }
 class g  {
 f blocks
 }
 template < typename >
 struct is_error_code_enum : a struct h {
   template < typename i,
              typename =  c< is_error_condition_enum<
                  i >::b >>
   h(i  
 }
  operator<( h ,
                h ;
 g:j() {
#pragma omp parallel for default(none)
 for (auto a = blocks.cbegin0; a < blocks; ++a)
   ;

./bin/clang++ -fopenmp
results in

clang-9: /build/llvm/include/llvm/Support/Casting.h:264: typename
llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X =
clang::sema::CapturingScopeInfo; Y = clang::sema::FunctionScopeInfo; typename
llvm::cast_retty<X, Y*>::ret_type = clang::sema::CapturingScopeInfo*
]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"'
failed.
Stack dump:
0.      Program arguments: /build/llvm-build-GCC-release/bin/clang-9 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name PanasonicDecompressorV5-58eb88.reduced.cpp -mrelocation-model
static -mthread-model posix -mdisable-fp-elim -fma
th-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -resource-dir
/build/llvm-build-GCC-release/lib/clang/9.0.0 -internal-isystem
/usr/lib64/gcc/x86_64-linux-gnu/8/../../../../include/c+
+/8 -internal-isystem
/usr/lib64/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8
-internal-isystem
/usr/lib64/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8
-internal-isystem /usr/lib64/gcc/x86_64-linux-gnu/8/../../../../include/c++/8
/backward -internal-isystem /usr/local/include -internal-isystem
/build/llvm-build-GCC-release/lib/clang/9.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro -fd
ebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 271 -fopenmp
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/PanasonicDecompressorV5-58eb88-43484c.o -x c++
PanasonicDecompressorV5-58eb88.reduced.cpp -fadd
rsig  
1.      <eof> parser at end of file
2.      PanasonicDecompressorV5-58eb88.reduced.cpp:23:9: parsing function body
'g::j'
3.      PanasonicDecompressorV5-58eb88.reduced.cpp:23:9: in compound statement
('{}')
#0 0x00007fe89bdec96a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/build/llvm/lib/Support/Unix/Signals.inc:494:22
#1 0x00007fe89bdea744 llvm::sys::RunSignalHandlers()
/build/llvm/lib/Support/Signals.cpp:68:20
#2 0x00007fe89bdea8a5 SignalHandler(int)
/build/llvm/lib/Support/Unix/Signals.inc:357:1
#3 0x00007fe89b85a730 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12730)
#4 0x00007fe89a3177bb raise (/lib/x86_64-linux-gnu/libc.so.6+0x377bb)
#5 0x00007fe89a302535 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22535)
#6 0x00007fe89a30240f (/lib/x86_64-linux-gnu/libc.so.6+0x2240f)
#7 0x00007fe89a310102 (/lib/x86_64-linux-gnu/libc.so.6+0x30102)
#8 0x00007fe8988faa86
llvm::SmallVectorTemplateCommon<clang::sema::FunctionScopeInfo*,
void>::operator[](unsigned long)
/build/llvm/include/llvm/ADT/SmallVector.h:149:5
#9 0x00007fe8988faa86 clang::Sema::tryCaptureVariable(clang::VarDecl*,
clang::SourceLocation, clang::Sema::TryCaptureKind, clang::SourceLocation,
bool, clang::QualType&, clang::QualType&, unsigned int const*)
/build/clang/lib/Sema/SemaExpr.cpp:15512:65
#10 0x00007fe8988fae01 clang::Sema::getCapturedDeclRefType(clang::VarDecl*,
clang::SourceLocation) /build/clang/lib/Sema/SemaExpr.cpp:15665:3
#11 0x00007fe8988fc607
clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec const&,
clang::DeclarationNameInfo const&, clang::NamedDecl*, clang::NamedDecl*,
clang::TemplateArgumentListInfo const*, bool)
/build/clang/lib/Sema/SemaExpr.cpp:3060:9
#12 0x00007fe8988fcafb
clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec const&,
clang::LookupResult&, bool, bool) /build/clang/lib/Sema/SemaExpr.cpp:2891:54
#13 0x00007fe8989a5b39
clang::Sema::BuildPossibleImplicitMemberExpr(clang::CXXScopeSpec const&,
clang::SourceLocation, clang::LookupResult&, clang::TemplateArgumentListInfo
const*, clang::Scope const*) /build/clang/lib/Sema/SemaExprMember.cpp:260:49
#14 0x00007fe8988fd110
clang::Sema::BuildQualifiedDeclarationNameExpr(clang::CXXScopeSpec&,
clang::DeclarationNameInfo const&, bool, clang::Scope const*,
clang::TypeSourceInfo**) /build/clang/lib/Sema/SemaExpr.cpp:2478:74
#15 0x00007fe898c04f8a RebuildDependentScopeDeclRefExpr
/build/clang/lib/Sema/TreeTransform.h:2835:68
#16 0x00007fe898c04f8a clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformDependentScopeDeclRefExpr(clang::DependentScopeDeclRefExpr*,
bool, clang::TypeSourceInfo**) /build/clang/lib/Sema/TreeTransform.h:10990:40
#17 0x00007fe898beb7b0 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*)
/build/llvm-build-GCC-release/tools/clang/include/clang/AST/StmtNodes.inc:925:1
#18 0x00007fe898bfd39d clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformTemplateArgument(clang::TemplateArgumentLoc
const&, clang::TemplateArgumentLoc&, bool)
/build/clang/lib/Sema/TreeTransform.h:3981:40
#19 0x00007fe898bff972
TransformTemplateArguments<clang::TemplateArgumentLocContainerIterator<clang::TemplateSpecializationTypeLoc>
> /build/clang/lib/Sema/TreeTransform.h:4161:5
#20 0x00007fe898bff972 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformTemplateSpecializationType(clang::TypeLocBuilder&,
clang::TemplateSpecializationTypeLoc, clang::TemplateName)
/build/clang/lib/Sema/TreeTransform.h:5974:3
#21 0x00007fe898bf527d TransformTemplateSpecializationType
/build/clang/lib/Sema/TreeTransform.h:5851:76
#22 0x00007fe898bf527d clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeLocBuilder&,
clang::TypeLoc) /build/clang/include/clang/AST/TypeNodes.def:100:1
#23 0x00007fe898bf9772 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformType(clang::TypeSourceInfo*)
/build/clang/lib/Sema/TreeTransform.h:4208:12
#24 0x00007fe898c00bff clang::Sema::SubstType(clang::TypeSourceInfo*,
clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation,
clang::DeclarationName, bool)
/build/clang/lib/Sema/SemaTemplateInstantiate.cpp:1591:54
#25 0x00007fe898b23433 SubstDefaultTemplateArgument(clang::Sema&,
clang::TemplateDecl*, clang::SourceLocation, clang::SourceLocation,
clang::TemplateTypeParmDecl*, llvm::SmallVectorImpl<clang::TemplateArgument>&)
/build/clang/lib/Sema/SemaTemplate.cpp:4602:26
#26 0x00007fe898b23d58
clang::Sema::SubstDefaultTemplateArgumentIfAvailable(clang::TemplateDecl*,
clang::SourceLocation, clang::SourceLocation, clang::Decl*,
llvm::SmallVectorImpl<clang::TemplateArgument>&, bool&)
/build/clang/lib/Sema/SemaTemplate.cpp:4744:5
#27 0x00007fe898bda7a5
ConvertDeducedTemplateArguments<clang::FunctionTemplateDecl>
/build/clang/lib/Sema/SemaTemplateDeduction.cpp:2667:5
#28 0x00007fe898bda7a5
clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*,
llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&,
llvm::SmallVectorImpl<clang::Sema::Original
CallArg> const*, bool, llvm::function_ref<bool ()>)
/build/clang/lib/Sema/SemaTemplateDeduction.cpp:3330:52
#29 0x00007fe898bdf6bd
clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool,
llvm::function_ref<bool (llvm::ArrayRef<clang::Qual
Type>)>) /build/clang/lib/Sema/SemaTemplateDeduction.cpp:3941:41
#30 0x00007fe898ab6f17
clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*,
clang::DeclAccessPair, clang::TemplateArgumentListInfo*,
llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, bool,
clang::CallExpr::ADLCallKind) /build/clan
g/lib/Sema/SemaOverload.cpp:6788:3
#31 0x00007fe898ab230c IsUserDefinedConversion(clang::Sema&, clang::Expr*,
clang::QualType, clang::UserDefinedConversionSequence&,
clang::OverloadCandidateSet&, bool, bool)
/build/clang/lib/Sema/SemaOverload.cpp:3375:43
#32 0x00007fe898ab2829 TryUserDefinedConversion(clang::Sema&, clang::Expr*,
clang::QualType, bool, bool, bool, bool, bool, bool) (.constprop.1404)
/build/clang/lib/Sema/SemaOverload.cpp:1257:3
#33 0x00007fe898ab2dd7 TryImplicitConversion(clang::Sema&, clang::Expr*,
clang::QualType, bool, bool, bool, bool, bool, bool)
/build/clang/lib/Sema/SemaOverload.cpp:1392:64
#34 0x00007fe898ab3d54 TryCopyInitialization(clang::Sema&, clang::Expr*,
clang::QualType, bool, bool, bool, bool)
/build/clang/lib/Sema/SemaOverload.cpp:5066:71
#35 0x00007fe898ab66ac
llvm::MutableArrayRef<clang::ImplicitConversionSequence>::operator[](unsigned
long) const /build/llvm/include/llvm/ADT/ArrayRef.h:417:7
#36 0x00007fe898ab66ac clang::Sema::AddOverloadCandidate(clang::FunctionDecl*,
clang::DeclAccessPair, llvm::ArrayRef<clang::Expr*>,
clang::OverloadCandidateSet&, bool, bool, bool, bool,
clang::CallExpr::ADLCallKind,
llvm::MutableArrayRef<clang::ImplicitConversionSequence
>) /build/clang/lib/Sema/SemaOverload.cpp:6156:35
#37 0x00007fe898ab95d1
clang::Sema::AddFunctionCandidates(clang::UnresolvedSetImpl const&,
llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&,
clang::TemplateArgumentListInfo*, bool, bool, bool)
/build/clang/lib/Sema/SemaOverload.cpp:6520:29
#38 0x00007fe898acaf6b
clang::Sema::CreateOverloadedBinOp(clang::SourceLocation,
clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*,
clang::Expr*, bool) /build/clang/lib/Sema/SemaOverload.cpp:12536:30
#39 0x00007fe8988c3c9a llvm::SmallVectorTemplateCommon<clang::DeclAccessPair,
void>::end() /build/llvm/include/llvm/ADT/SmallVector.h:129:35
#40 0x00007fe8988c3c9a llvm::SmallVector<clang::DeclAccessPair,
16u>::~SmallVector() /build/llvm/include/llvm/ADT/SmallVector.h:847:5
#41 0x00007fe8988c3c9a clang::UnresolvedSet<16u>::~UnresolvedSet()
/build/clang/include/clang/AST/UnresolvedSet.h:143:42
#42 0x00007fe8988c3c9a BuildOverloadedBinOp(clang::Sema&, clang::Scope*,
clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
/build/clang/lib/Sema/SemaExpr.cpp:12924:21
#43 0x00007fe8988f0b92 clang::Sema::BuildBinOp(clang::Scope*,
clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
/build/clang/lib/Sema/SemaExpr.cpp:13040:1
#44 0x00007fe898a59646 buildPreCond /build/clang/lib/Sema/SemaOpenMP.cpp:5244:3
#45 0x00007fe898a59646 checkOpenMPIterationSpace(clang::OpenMPDirectiveKind,
clang::Stmt*, clang::Sema&, (anonymous namespace)::DSAStackTy&, unsigned int,
unsigned int, unsigned int, clang::Expr*, clang::Expr*,
llvm::SmallDenseMap<clang::ValueDecl const*, clang::Expr con
st*, 4u, llvm::DenseMapInfo<clang::ValueDecl const*>,
llvm::detail::DenseMapPair<clang::ValueDecl const*, clang::Expr const*> >&,
(anonymous namespace)::LoopIterationSpace&, llvm::MapVector<clang::Expr const*,
clang::DeclRefExpr*, llvm::DenseMap<clang::Expr const*, unsig
ned int, llvm::DenseMapInfo<clang::Expr const*>,
llvm::detail::DenseMapPair<clang::Expr const*, unsigned int> >,
std::vector<std::pair<clang::Expr const*, clang::DeclRefExpr*>,
std::allocator<std::pair<clang::Expr const*, clang::DeclRefExpr*> > > >&)
/build/clang/lib/Sem
a/SemaOpenMP.cpp:5551:23
#46 0x00007fe898a5d8a1 checkOpenMPLoop(clang::OpenMPDirectiveKind,
clang::Expr*, clang::Expr*, clang::Stmt*, clang::Sema&, (anonymous
namespace)::DSAStackTy&, llvm::SmallDenseMap<clang::ValueDecl const*,
clang::Expr const*, 4u, llvm::DenseMapInfo<clang::ValueDecl const*>
, llvm::detail::DenseMapPair<clang::ValueDecl const*, clang::Expr const*> >&,
clang::OMPLoopDirective::HelperExprs&)
/build/clang/lib/Sema/SemaOpenMP.cpp:5817:5
#47 0x00007fe898a61642
clang::Sema::ActOnOpenMPParallelForDirective(llvm::ArrayRef<clang::OMPClause*>,
clang::Stmt*, clang::SourceLocation, clang::SourceLocation,
llvm::SmallDenseMap<clang::ValueDecl const*, clang::Expr const*, 4u,
llvm::DenseMapInfo<clang::ValueDecl con
st*>, llvm::detail::DenseMapPair<clang::ValueDecl const*, clang::Expr const*>
>&) /build/clang/lib/Sema/SemaOpenMP.cpp:6779:22
#48 0x00007fe898a6b731
clang::Sema::ActOnOpenMPExecutableDirective(clang::OpenMPDirectiveKind,
clang::DeclarationNameInfo const&, clang::OpenMPDirectiveKind,
llvm::ArrayRef<clang::OMPClause*>, clang::Stmt*, clang::SourceLocation,
clang::SourceLocation) /build/clang/lib/S
ema/SemaOpenMP.cpp:3979:71
#49 0x00007fe898d5e9c6
clang::Parser::ParseOpenMPDeclarativeOrExecutableDirective(clang::Parser::ParsedStmtContext)
/build/clang/lib/Parse/ParseOpenMP.cpp:1468:30
#50 0x00007fe898d70e10
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
/build/clang/lib/Parse/ParseStmt.cpp:366:63
#51 0x00007fe898d71be9 llvm::PointerUnion<clang::ParsedAttr*,
llvm::SmallVector<clang::ParsedAttr*, 4u>*>::isNull() const
/build/llvm/include/llvm/ADT/PointerUnion.h:116:59
#52 0x00007fe898d71be9 llvm::TinyPtrVector<clang::ParsedAttr*>::empty() const
/build/llvm/include/llvm/ADT/TinyPtrVector.h:162:5
#53 0x00007fe898d71be9 clang::ParsedAttributesView::empty() const
/build/clang/include/clang/Sema/ParsedAttr.h:816:45
#54 0x00007fe898d71be9
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
/build/clang/lib/Parse/ParseStmt.cpp:109:3
#55 0x00007fe898d7607a clang::Parser::ParseCompoundStatementBody(bool)
/build/clang/lib/Parse/ParseStmt.cpp:1057:56
#56 0x00007fe898d782f8 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) /build/clang/lib/Parse/ParseStmt.cpp:2073:3
#57 0x00007fe898d96c52
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
/build/clang/lib/Parse/Parser.cpp:1326:36
#58 0x00007fe898d17927 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
/build/clang/lib/Parse/ParseDecl.cpp:2040:54
#59 0x00007fe898d92168
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/build/clang/lib/Parse/Parser.cpp:1096:1
#60 0x00007fe898d927b1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.265)
/build/clang/lib/Parse/Parser.cpp:1111:57
#61 0x00007fe898d974b8
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (.localalias.281)
/build/clang/lib/Parse/Parser.cpp:931:58
#62 0x00007fe898d981b8
clang::Parser::ParsedAttributesWithRange::~ParsedAttributesWithRange()
/build/clang/include/clang/Parse/Parser.h:1449:10
#63 0x00007fe898d981b8
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/build/clang/lib/Parse/Parser.cpp:679:46
#64 0x00007fe898cf8758 clang::ParseAST(clang::Sema&, bool, bool)
/build/clang/lib/Parse/ParseAST.cpp:157:56
#65 0x00007fe89b295dd0 clang::CodeGenAction::ExecuteAction()
/build/clang/lib/CodeGen/CodeGenAction.cpp:1057:1
#66 0x00007fe89ab45ede clang::FrontendAction::Execute()
/build/clang/lib/Frontend/FrontendAction.cpp:934:21
#67 0x00007fe89ab01d06
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/build/clang/lib/Frontend/CompilerInstance.cpp:945:24
#68 0x00007fe89aa049e3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/build/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:274:43
#69 0x00005625cdb523a8 llvm::TimeTraceScope::~TimeTraceScope()
/build/llvm/include/llvm/Support/TimeProfiler.h:69:5
#70 0x00005625cdb523a8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /build/clang/tools/driver/cc1_main.cpp:224:68
#71 0x00005625cdb513bf ExecuteCC1Tool
/build/clang/tools/driver/driver.cpp:309:20
#72 0x00005625cdb513bf main /build/clang/tools/driver/driver.cpp:381:26
#73 0x00007fe89a30409b __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2409b)
#74 0x00005625cdb4d02a _start
(/build/llvm-build-GCC-release/bin/clang-9+0xf02a)
clang-9: error: unable to execute command: Aborted
clang-9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0 (trunk 360109) (llvm/trunk 360111)

(beware, i've observed that those llvm traces are imprecise)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190509/dadaa0f9/attachment-0001.html>


More information about the llvm-bugs mailing list