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

            Bug ID: 41854
           Summary: Regression since "Reject attempts to call non-static
                    member functions on objects outside their lifetime in
                    constant expressions."
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: mar...@martin.st
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

Created attachment 21939
  --> https://bugs.llvm.org/attachment.cgi?id=21939&action=edit
Original non-reduced reproduction source

Since "Reject attempts to call non-static member functions on objects outside
their lifetime in constant expressions.", SVN r360538, compiling harfbuzz
fails. It can be reproduced with the following reduced (and broken) piece of
code:

$ cat reduced.cpp 
struct e { operator int( } struct f { e c}
int  a f &d =     reinterpret_cast< f & >(a;
unsigned b = d.c
$ clang -target x86_64-w64-mingw32 -c reduced.cpp
clang-9: ../tools/clang/lib/AST/ExprConstant.cpp:306: bool
{anonymous}::SubobjectDesignator::isOnePastTheEnd() const: Assertion `!Invalid'
failed.
Stack dump:
0.      Program arguments: /home/martin/clang-nightly-mon/bin/clang-9 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name reduced.cpp -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debugger-tuning=gdb -coverage-notes-file
/home/martin/code/reduce-harfbuzz/reduced.gcno -resource-dir
/home/martin/clang-nightly-mon/lib/clang/9.0.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward
-internal-isystem /usr/local/include -internal-isystem
/home/martin/clang-nightly-mon/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 -fdebug-compilation-dir /home/martin/code/reduce-harfbuzz
-ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -o reduced.o -x c++ reduced.cpp
-faddrsig 
1.      <eof> parser at end of file
 #0 0x0000556f9d3a038a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/martin/clang-nightly-mon/bin/clang-9+0x1e8338a)
 #1 0x0000556f9d39e034 llvm::sys::RunSignalHandlers()
(/home/martin/clang-nightly-mon/bin/clang-9+0x1e81034)
 #2 0x0000556f9d39e172 (/home/martin/clang-nightly-mon/bin/clang-9+0x1e81172)
 #3 0x00007f850c0f2890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007f850ada3e97 gsignal
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f850ada5801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007f850ad9539a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007f850ad95412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x0000556f9f21c1da (/home/martin/clang-nightly-mon/bin/clang-9+0x3cff1da)
 #9 0x0000556f9c09b79e _init
(/home/martin/clang-nightly-mon/bin/clang-9+0xb7e79e)
#10 0x0000556f9c0a3b6c _init
(/home/martin/clang-nightly-mon/bin/clang-9+0xb86b6c)
#11 0x0000556f9f2414cb (/home/martin/clang-nightly-mon/bin/clang-9+0x3d244cb)
#12 0x0000556f9f2330dd (/home/martin/clang-nightly-mon/bin/clang-9+0x3d160dd)
#13 0x0000556f9f23511e (/home/martin/clang-nightly-mon/bin/clang-9+0x3d1811e)
#14 0x0000556f9f2359bf clang::Expr::EvaluateAsRValue(clang::Expr::EvalResult&,
clang::ASTContext const&, bool) const
(/home/martin/clang-nightly-mon/bin/clang-9+0x3d189bf)
#15 0x0000556f9ea7d535 (/home/martin/clang-nightly-mon/bin/clang-9+0x3560535)
#16 0x0000556f9ea8c7df (/home/martin/clang-nightly-mon/bin/clang-9+0x356f7df)
#17 0x0000556f9ea900bb (/home/martin/clang-nightly-mon/bin/clang-9+0x35730bb)
#18 0x0000556f9ea920f2 clang::Sema::CheckCompletedExpr(clang::Expr*,
clang::SourceLocation, bool)
(/home/martin/clang-nightly-mon/bin/clang-9+0x35750f2)
#19 0x0000556f9ecbe311 clang::Sema::ActOnFinishFullExpr(clang::Expr*,
clang::SourceLocation, bool, bool)
(/home/martin/clang-nightly-mon/bin/clang-9+0x37a1311)
#20 0x0000556f9eb15aa3 clang::Sema::AddInitializerToDecl(clang::Decl*,
clang::Expr*, bool) (/home/martin/clang-nightly-mon/bin/clang-9+0x35f8aa3)
#21 0x0000556f9e9189de
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/home/martin/clang-nightly-mon/bin/clang-9+0x33fb9de)
#22 0x0000556f9e9278ab clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/home/martin/clang-nightly-mon/bin/clang-9+0x340a8ab)
#23 0x0000556f9e902220
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) (/home/martin/clang-n
ightly-mon/bin/clang-9+0x33e5220)
#24 0x0000556f9e902981 (/home/martin/clang-nightly-mon/bin/clang-9+0x33e5981)
#25 0x0000556f9e9067f0
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/home/martin/clang-nightly-mon/bin/clang-9+0x33e97
f0)
#26 0x0000556f9e907c49
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/home/martin/clang-nightly-mon/bin/clang-9+0x33eac49)
#27 0x0000556f9e8fd8b9 clang::ParseAST(clang::Sema&, bool, bool)
(/home/martin/clang-nightly-mon/bin/clang-9+0x33e08b9)
#28 0x0000556f9dfc47f8 clang::CodeGenAction::ExecuteAction()
(/home/martin/clang-nightly-mon/bin/clang-9+0x2aa77f8)
#29 0x0000556f9da5d56e clang::FrontendAction::Execute()
(/home/martin/clang-nightly-mon/bin/clang-9+0x254056e)
#30 0x0000556f9da1fae6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/martin/clang-nightly-mon/bin/clang-9+0x2502ae6)
#31 0x0000556f9db02a3d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/martin/clang-nightly-mon/bin/clang-9+0x25e5a3d)
#32 0x0000556f9c125a88 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/martin/clang-nightly-mon/bin/clang-9+0xc08a88)
#33 0x0000556f9c0be321 main
(/home/martin/clang-nightly-mon/bin/clang-9+0xba1321)
#34 0x00007f850ad86b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#35 0x0000556f9c12187a _start
(/home/martin/clang-nightly-mon/bin/clang-9+0xc0487a)
clang-9: error: unable to execute command: Aborted (core dumped)


The full original (non-broken) source that triggered it is attached as well.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to