[llvm] r257164 - Re-commit r257064, this time with a fixed assert

Joerg Sonnenberger via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 9 19:36:33 PST 2016


On Fri, Jan 08, 2016 at 11:11:05AM -0000, Silviu Baranga via llvm-commits wrote:
> Author: sbaranga
> Date: Fri Jan  8 05:11:04 2016
> New Revision: 257164
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=257164&view=rev
> Log:
> Re-commit r257064, this time with a fixed assert

This results in segmentation faults when compiling the attached input
samples with -O2.

Joerg
-------------- next part --------------
class CSphFixedVector {
public:
  CSphFixedVector(int);
  ~CSphFixedVector();
};
class A {
public:
  A(int);
  int SendInt___trans_tmp_1;
  void SendInt() { SendT(SendInt___trans_tmp_1); }
  void SendWord() { SendT(0); }
  unsigned char *m_pBuffer;
  int m_iBufferSize;
  unsigned char *m_pBufferPtr;
  bool m_bError;
  unsigned char *m_pSize;
  bool ResizeIf();
  template <typename T> bool SendT(T);
};

template <typename T> bool A::SendT(T) {
  ResizeIf();
  m_pBufferPtr += sizeof(T);
  return true;
}

int a, c, d;
A::A(int) : m_iBufferSize(2) {
  m_pBuffer = new unsigned char;
  m_pBufferPtr = m_pBuffer;
}

bool A::ResizeIf() {
  if (m_pBufferPtr + a >= m_pBuffer + m_iBufferSize) {
    int b = m_pSize - m_pBuffer;
    m_pSize = m_pBuffer + b;
  }
  return m_bError;
}

void fn1() {
  CSphFixedVector e(c);
  A f(d);
  f.SendWord();
  f.SendInt();
}
-------------- next part --------------
class QoreString {
public:
  ~QoreString();
};
class A {
public:
  A(QoreString *);
};
char a;
char *fn1(char *, int);
void fn2() {
  QoreString b;
  char *i = fn1(&a, '$'), *c = ++i;
  if (c)
    ++c;
  if (c != i)
    A(0);
}


More information about the llvm-commits mailing list