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

[creduce-bugs] A few crashes



Please consider:

 % cat test.ii
extern "C" class WvFastString;
typedef WvFastString& WvStringParm;
struct WvFastString {
  ~WvFastString();
  operator char* () {}
};
class WvString : WvFastString {};
class WvAddr {};
class WvIPAddr : WvAddr {};
struct WvIPNet : WvIPAddr {
  bool is_default() {}
};
template<class T, bool> struct WvTraits_Helper {
  static void release(T *obj) {
    delete obj;
  }
};
template<class From> struct WvTraits {
  static void release(From *obj) {
    WvTraits_Helper<From, 0>::release(obj);
  }
};
struct WvLink {
  void   *data;
  WvLink *next;
  bool    autofree;
  WvLink(bool, int) : autofree() {}
  bool get_autofree() {}

  void unlink() {
    delete this;
  }
};
struct WvListBase {
  WvLink head, *tail;
  WvListBase() : head(0, 0) {}
};
template<class T> struct WvList : WvListBase {
  ~WvList() {
    zap();
  }

  void zap(bool destroy = 1) {
    while (head.next) unlink_after(&head, destroy);
  }

  void unlink_after(WvLink *after, bool destroy) {
    WvLink *next = 0;
    T *obj       = (destroy && next->get_autofree()) ? 
                   static_cast<T*>(next->data) : 0;

    if (tail) tail = after;
    next->unlink();
    WvTraits<T>::release(obj);
  }
};
typedef WvList<WvString>WvStringListBase;
class WvStringList : WvStringListBase {};
class WvSubProc {
  WvStringList last_args, env;
};
void addroute(WvIPNet& dest, WvStringParm table) {
  if (dest.is_default() || (table != 0)) WvSubProc checkProc;
}

 % clang_delta --transformation=copy-propagation --counter=1 test.ii 
Stack dump:
0.      test.ii:57:1: current parser token 'typedef'
[1]    2879 segmentation fault

 % clang_delta --transformation=reduce-pointer-level --counter=3 test.ii 
Stack dump:
0.      <eof> parser at end of file
[1]    2910 segmentation fault 

 % clang_delta --transformation=rename-fun --counter=1 test.ii 
Stack dump:
0.      test.ii:23:1: current parser token 'struct'
[1]    4088 segmentation fault 

 % clang -v
clang version 3.1 (trunk)
Target: x86_64-unknown-linux-gnu
Thread model: posix

creduce % git describe
creduce-1.0.0-166-gc63daef

-- 
Markus