This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/67918] -fdevirtualize causes binary to crash with Segmentation Fault (CryptoPP involved)


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67918

--- Comment #4 from Nameless <11throwaway11 at outlook dot com> ---
A little update.

I decided to check the piece of code that was causing "execution reached
__builtin_unreachable() call". So here's it:

virtual void ResizeBuffers()
{
        m_register.New(m_cipher->BlockSize());
}

Here's the BlockSize:

inline unsigned int BlockSize() const {assert(m_register.size() > 0); return
(unsigned int)m_register.size();}

I thought: probably __builtin_unreachable() is what happens when the assert
gets called with 'false'.

So I changed ResizeBuffers() to:

virtual void ResizeBuffers()
{
        printf("m_register: %p\nm_cipher: %p\n", &m_register, m_cipher); //
m_cipher is a pointer
        m_register.New(m_cipher->BlockSize());
}

To check whether it does something with a NULL pointer.

And now's the weird part: it made the code work.

If I comment out printf(), it breaks again.
I've no idea what's going on.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]