[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[creduce-bugs] Crash in RewriteUtils.cpp:1599



markus@x4 /tmp % gdb --args /home/markus/creduce/creduce/../clang_delta/clang_delta --transformation=replace-derived-class --counter=1 foo.ii
Reading symbols from /home/markus/creduce/creduce/../clang_delta/clang_delta...done.
(gdb) run
Starting program: /home/markus/creduce/clang_delta/clang_delta --transformation=replace-derived-class --counter=1 foo.ii
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
RewriteUtils::replaceRecordType (this=0x2096bc0, RTLoc=..., Name="allocator") at RewriteUtils.cpp:1599
1599      return !(TheRewriter->ReplaceText(LocStart, TypeId->getLength(), Name));
(gdb) l
1594      // Is the guard below too strong? It is possible it could mask other
1595      // potential bugs?
1596      if (LocStart.isInvalid())
1597        return true;
1598
1599      return !(TheRewriter->ReplaceText(LocStart, TypeId->getLength(), Name));
1600    }
1601
1602    bool RewriteUtils::isTheFirstDecl(const VarDecl *VD)
1603    {
(gdb) bt
#0  RewriteUtils::replaceRecordType (this=0x2096bc0, RTLoc=..., Name="allocator") at RewriteUtils.cpp:1599
#1  0x0000000000ebd97d in clang_delta_common_visitor::CommonRenameClassRewriteVisitor<ReplaceDerivedClassRewriteVisitor>::VisitRecordTypeLoc (this=0x210bd50, RTLoc=...)
    at CommonRenameClassRewriteVisitor.h:290
#2  0x0000000000ebda3f in clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::WalkUpFromRecordTypeLoc (TL=..., this=<optimized out>)
    at /usr/local/include/clang/AST/TypeNodes.def:91
#3  clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::TraverseRecordTypeLoc (this=this@entry=0x210bd50, TL=...)
    at /usr/local/include/clang/AST/RecursiveASTVisitor.h:1249
#4  0x0000000000ee030a in clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::TraverseTypeLoc (this=this@entry=0x210bd50, TL=...)
    at /usr/local/include/clang/AST/TypeNodes.def:91
#5  0x0000000000ee1cdc in clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::TraverseElaboratedTypeLoc (this=this@entry=0x210bd50, TL=...)
    at /usr/local/include/clang/AST/RecursiveASTVisitor.h:1270
#6  0x0000000000ee033a in clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::TraverseTypeLoc (this=this@entry=0x210bd50, TL=...)
    at /usr/local/include/clang/AST/TypeNodes.def:93
#7  0x0000000000ef68fc in clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::TraverseDeclaratorHelper (this=this@entry=0x210bd50, D=D@entry=0x20fa750)
    at /usr/local/include/clang/AST/RecursiveASTVisitor.h:1846
#8  0x0000000000ef6961 in clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::TraverseFieldDecl (this=0x210bd50, D=0x20fa750)
    at /usr/local/include/clang/AST/RecursiveASTVisitor.h:1866
#9  0x0000000000edaffa in clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::TraverseDecl (this=this@entry=0x210bd50, D=D@entry=0x20fa750)
    at /usr/local/include/clang/AST/DeclNodes.inc:369
#10 0x0000000000edb53a in clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::TraverseDeclContextHelper (this=this@entry=0x210bd50, DC=DC@entry=0x20fa340)
    at /usr/local/include/clang/AST/RecursiveASTVisitor.h:1332
#11 0x0000000000ef678e in clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::TraverseCXXRecordDecl (this=0x210bd50, D=0x20fa308)
    at /usr/local/include/clang/AST/RecursiveASTVisitor.h:1769
#12 0x0000000000edaeaa in clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::TraverseDecl (this=this@entry=0x210bd50, D=D@entry=0x20fa308)
    at /usr/local/include/clang/AST/DeclNodes.inc:251
#13 0x0000000000edb53a in clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::TraverseDeclContextHelper (this=0x210bd50, DC=<optimized out>)
    at /usr/local/include/clang/AST/RecursiveASTVisitor.h:1332
#14 0x0000000000edbf1e in clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::TraverseTranslationUnitDecl (this=<optimized out>, D=<optimized out>)
    at /usr/local/include/clang/AST/RecursiveASTVisitor.h:1424
#15 0x0000000000edb267 in clang::RecursiveASTVisitor<ReplaceDerivedClassRewriteVisitor>::TraverseDecl (this=0x210bd50, D=0x2095c60)
    at /usr/local/include/clang/AST/DeclNodes.inc:553
#16 0x0000000000edb3e9 in ReplaceDerivedClass::HandleTranslationUnit (this=0x2072bc0, Ctx=...) at ReplaceDerivedClass.cpp:101
#17 0x00007f11098b5b42 in clang::ParseAST(clang::Sema&, bool, bool) () from /usr/local/lib/libclangParse.so.5
#18 0x00000000012fe621 in TransformationManager::doTransformation (this=0x20782f0, ErrorMsg="", ErrorCode=@0x203d960: -1) at TransformationManager.cpp:260
#19 0x00000000004a96eb in main (argc=4, argv=0x7fffffffe4c8) at ClangDelta.cpp:228

--
Markus
struct integral_constant ;
template < int > using __bool_constant = integral_constant;
template < typename _Tp >
struct is_constructible : __bool_constant< __is_constructible(_Tp) > {};
template < typename > struct remove_reference;
template < typename _Tp > struct remove_reference< _Tp & > {
  typedef _Tp type;
};
template < int > struct enable_if;
 struct pair ;
struct allocator {
  allocator();
};
template < typename , typename > using __alloc_rebind = allocator;
struct allocator_traits {
  template < typename _Tp >
  using rebind_alloc = __alloc_rebind< allocator, _Tp >;
};
struct rebind {
  typedef allocator_traits::rebind_alloc< int > other;
};
struct Trans_NS___cxx11_basic_string {
  struct : rebind::other {} _M_dataplus;
};
template < typename... > struct list;
template < typename T > using _t = typename T::type;
template < int > using bool_ = integral_constant;
template < typename F, typename... Args >
using invoke = typename F::template invoke< Args... >;
template < typename T > struct id { using type = T; };
template < template < typename > class C, typename... Ts,
           template < typename > class D = C >
id< D< Ts... > > try_defer_(int);
template < template < typename > class C, typename... Ts >
using defer_ = decltype(try_defer_< C, Ts... >(0));
template < template < typename > class C > struct quote {
  template < typename... Ts > using invoke = _t< defer_< C, Ts... > >;
};
template < typename F, typename... Us > struct bind_back {
  template < typename... Ts > using invoke = invoke< F, Ts..., Us... >;
};
namespace extension {
template < typename, typename > struct apply;
template < typename F, template < typename > class T, typename... Ts >
struct apply< F, T< Ts... > > : invoke< F, Ts... > {};
} template < typename C, typename List >
using apply = _t< extension::apply< C, List > >;
template < typename > struct _if_;
template < int If > using if_c = _t< _if_< list< bool_< If > > > >;
template < bool... > using and_c = int;
template < typename... Bools > using strict_and = and_c< Bools::value... >;
template < typename > struct transform_;
template < typename... Ts, typename Fun >
struct transform_< list< list< Ts... >, Fun > > {
  using type = list< invoke< Fun, Ts >... >;
};
template < typename... Args >
using transform = _t< transform_< list< Args... > > >;
struct any_ ;
using any = any_;
template < typename, typename... > struct models;
template < typename T > using uncvref_t = _t< remove_reference< T > >;
template < typename T > T *_nullptr_v();
template < typename Concept > struct base_concepts_of {
  using type = typename Concept::base_concepts_t;
};
template < typename Concept >
using base_concepts_of_t = _t< base_concepts_of< Concept > >;
;
 ;
template < typename... Ts, typename Concept,
           typename = decltype
               (&Concept::template requires_< Ts... >) >
auto models_(Concept *)
    -> apply< quote< strict_and >,
              transform< base_concepts_of_t< Concept >,
                         bind_back< quote< models >, Ts... > > >;
template < typename... Concepts > struct refines {
  using base_concepts_t = list< Concepts... >;
  template < typename > void requires_();
};
template < typename Concept, typename... Ts >
struct models
    : bool_<
          _t< decltype(models_< Ts... >(_nullptr_v< Concept >())) >::value > {};
template < typename Concept, typename... Ts >
auto model_of() -> if_c< models< Concept, Ts... >::valueint >;
struct Constructible {
  template < typename T > void requires_(decltype(is_constructible< T >{}));
};
struct Copyable ;
struct Trans_NS_concepts_View {
  template < typename T >
  void requires_(decltype(model_of< refines<  Constructible >, T >));
};
template < typename T > using View = models< Trans_NS_concepts_View, T >;
struct {
  template < typename T, int = enable_if< (View< uncvref_t< T > >()) >::type >
  void  operator()(T &&);
} all;
void test_iter() {
  using P =  Trans_NS___cxx11_basic_string ;
  P ia[]{{}};
  all(ia)