Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Error recovery can trigger Assertion `DefinitionData && "queried property of class with no definition"' (DeclCXX.h:617) #12883

Open Quuxplusone opened 12 years ago

Quuxplusone commented 12 years ago
Bugzilla Link PR12777
Status NEW
Importance P normal
Reported by Hal Finkel (hfinkel@anl.gov)
Reported on 2012-05-09 14:09:03 -0700
Last modified on 2018-10-15 15:58:00 -0700
Version trunk
Hardware PC Linux
CC Aleksandrs.Saveljevs@gmail.com, dgregor@apple.com, llvm-bugs@lists.llvm.org, popizdeh@gmail.com, rbock@eudoxos.de
Fixed by commit(s)
Attachments prog-mSuOGe.ii (501 bytes, application/octet-stream)
reduced-queried.ii (1104 bytes, application/octet-stream)
Blocks
Blocked by
See also PR39311
Created attachment 8520
reduced test case (provided by C.S.)

Running clang trunk on x86_64 on:

 template<class _CharT> struct char_traits;
     template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ios;
   class ios_base {
      iostate _M_exception;
    template<typename _CharT, typename _Traits> basic_ios<_CharT, _Traits>& basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) {
        _M_exception = goodbit;

results in:

In file included from prog.cpp:1:
prog.cpp:4:7: error: unknown type name 'iostate'
      iostate _M_exception;
      ^
prog.cpp:5:119: error: use of class template basic_ios requires template
arguments
    template<typename _CharT, typename _Traits> basic_ios<_CharT, _Traits>& basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) {
                                                                                                                      ^
prog.cpp:2:79: note: template is declared here
     template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ios;
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       ^
prog.cpp:5:105: error: out-of-line definition of 'copyfmt' from class
'basic_ios<_CharT, _Traits>' without definition
    template<typename _CharT, typename _Traits> basic_ios<_CharT, _Traits>& basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) {
                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
prog.cpp:6:32: error: expected '}'
        _M_exception = goodbit;
                               ^
prog.cpp:3:19: note: to match this '{'
   class ios_base {
                  ^
clang: /src/llvm-trunk-
writable/tools/clang/lib/AST/../../include/clang/AST/DeclCXX.h:617: const
clang::CXXRecordDecl::DefinitionData& clang::CXXRecordDecl::data() const:
Assertion `DefinitionData && "queried property of class with no definition"'
failed.
Quuxplusone commented 12 years ago

Attached prog-mSuOGe.ii (501 bytes, application/octet-stream): reduced test case (provided by C.S.)

Quuxplusone commented 11 years ago
This looks similar:
FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
Target: x86_64-unknown-freebsd9.0
Thread model: posix

compile.c++.without-pth
/home/rbock/projects/girocount/.build/develop/BillingApp/clang-freebsd-3.1/debug/threading-multi/TableHoldback.o
In file included from TableHoldback.cpp:1:
../BillingApp/TableHoldback.h:5:10: fatal error: 'GirocountBilling.h' file not
found
#include <GirocountBilling.h>
         ^
Assertion failed: (DefinitionData && "queried property of class with no
definition"), function data, file
/usr/src/lib/clang/libclangsema/../../../contrib/llvm/tools/clang/include/clang/AST/DeclCXX.h,
line 614.
Stack dump:
0.      Program arguments: /basejail/usr/bin/clang++ -cc1 -triple x86_64-
unknown-freebsd9.0 -emit-obj -mrelax-all -disable-free -main-file-name
TableHoldback.cpp -pic-level 2 -mdisable-fp-elim -masm-verbose -mconstructor-
aliases -munwind-tables -target-cpu x86-64 -momit-leaf-frame-pointer -coverage-
file /home/rbock/projects/girocount/.build/develop/BillingApp/clang-freebsd-
3.1/debug/threading-multi/TableHoldback.o -resource-dir
/basejail/usr/bin/../lib/clang/3.1 -I .. -I
/home/rbock/projects/girocount/.build/develop/submodules/clang-freebsd-
3.1/debug/threading-multi -I /usr/local/include -I /usr/local/rmg/include -
fmodule-cache-path /var/tmp/clang-module-cache -stdlib=libc++ -stdlib=libc++ -
O0 -Wall -std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/home/rbock/projects/girocount/BillingApp -ferror-limit 19 -fmessage-length 0 -
pthread -mstackrealign -fno-inline -fgnu-runtime -fobjc-runtime-has-arc -fobjc-
runtime-has-weak -fobjc-dispatch-method=non-legacy -fcxx-exceptions -
fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/home/rbock/projects/girocount/.build/develop/BillingApp/clang-freebsd-
3.1/debug/threading-multi/TableHoldback.o -x c++ TableHoldback.cpp
1.      TableHoldback.cpp:14:88: current parser token ':'
2.      TableHoldback.cpp:10:1: parsing namespace 'Girocount'
3.      TableHoldback.cpp:12:2: parsing namespace 'Billing'
clang++: error: unable to execute command: Abort trap: 6 (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see
invocation)
clang++: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang++: note: diagnostic msg: Error generating preprocessed source(s).
Quuxplusone commented 10 years ago
Comment on attachment 8996
another test case

This does not crash clang++ 3.4.1.

The sample code provided by Hal Finkel still, does, though.
Quuxplusone commented 12 years ago

Attached reduced-queried.ii (1104 bytes, application/octet-stream): another test case

Quuxplusone commented 10 years ago
template<typename T>
class A;

class B {
  int member;
  template<typename T>
  void A<T>::foo() {
    member = 0;
  }
};

Crashes with r213220.