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

Re: [creduce-dev] puzzling clang_delta crash

'clang++' treats sources as C++ code while 'clang' treats sources based on the file extension. Try compiling this 

#ifdef __cplusplus 

with clang a.c, clang a.cpp, clang++ a.c, clang++ a.cpp.

2015-11-12 14:31 GMT+02:00 John Regehr <regehr@cs.utah.edu>:
See below an interaction I just had with clang_delta.  It crashes when run on a variant but then fails to crash when that file is renamed.

Perhaps clang is behaving differently on a .cpp file vs. a file with no extension?

In any case, C-Reduce's current strategy of copying a crash-inducing file into the cwd is going to need to be revised for the case of multi-file reduction.  I plan to do this by making a copy of the temp dir where the crash-inducing variant was being evaluated.  As a side effect, we'll no longer be renaming files.


$ "/home/regehr/creduce-install/libexec/clang_delta" --transformation=remove-nested-function --counter=1 hello.cpp
Segmentation fault (core dumped)
$ "/home/regehr/creduce-install/libexec/clang_delta" --transformation=remove-nested-function --counter=1 creduce_bug_634227
Error: The counter value exceeded the number of transformation instances!
$ diff hello.cpp creduce_bug_634227
$ cat hello.cpp
#include "ostream"
namespace std _GLIBCXX_VISIBILITY(default) {
                           extern ostream cout;
                           static ios_base::Init __ioinit;
int main() {
           std::cout << "Hello World!++" << std::endl;
$ cat ostream
 #include "iosfwd"
#include "exception"
#include "char_traits.h"
#include "localefwd.h"
#include "ios_base.h"
#include "basic_ios.h"
namespace std _GLIBCXX_VISIBILITY(default) {
         _GLIBCXX_BEGIN_NAMESPACE_VERSION   template<typename _CharT, typename _Traits>     class basic_ostream : virtual public basic_ios<_CharT, _Traits>     {
          public:       typedef _CharT                                  char_type;
            typedef basic_ostream               __ostream_type;
            __ostream_type&       operator<<(__ostream_type& (__ostream_type&))       ;
            __ostream_type&       put;
            __ostream_type&       flush;
           /**    *  @brief  String inserters    *  @param  __out  An output stream.    *  @param  __s  A character string.    *  @return  out    *  @pre  @p __s must be a non-NULL pointer    *    *  Behaves like one of the formatted arithmetic inserters described in    * std::basic_ostream.  After constructing a sentry object with good    * status, this function inserts @c traits::length characters starting    *  at @p __s, widened if necessary, followed by any required padding . @c __out.width is then called.   */  template<typename _CharT, typename _Traits>     inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)     {
            if (!__s)   __out.setstate(ios_base::badbit);
            else        __ostream_insert(__out, __s,                     static_cast<streamsize>(_Traits::length(__s)));
            return __out;
           /**    *  @brief  Write a newline and flush the stream.    *    *  This manipulator is often mistakenly used when a simple newline is    *  desired, leading to poor buffering performance.  See    * http:    *  for more on this subject.   */  template<typename _CharT, typename _Traits>     inline basic_ostream<_CharT, _Traits>& endl(basic_ostream<_CharT, _Traits>& __os)     ;
          template<typename _CharT, typename _Traits>     inline basic_ostream<_CharT, _Traits>&     flush(basic_ostream<_CharT, _Traits>& __os)     ;
#if __cplusplus >= 201103L