OS X:g ++编译的程序得到总线错误,而clang编译没有

时间:2016-10-14 06:16:58

标签: c++ gcc memory clang bus-error

我正在研究Kevin Beason's smallpt

该程序与clang-omp++ smallpt.cpp运行良好。

但在g++ -fopenmp smallpt.cpp

下,情况并不顺利
  1. 重复警告(已成功编译):
  2.   

    /var/folders/j_/5w2s7bwx4zl9r_m976qpmpcc0000gn/T//ccEDNQ2r.s:612:11:   注意:将部分名称更改为“__text”           .section __TEXT,__ textcoal_nt,coalesced,pure_instructions                    ^ ~~~~~~~~~~~~~

         

    /var/folders/j_/5w2s7bwx4zl9r_m976qpmpcc0000gn/T//ccEDNQ2r.s:1571:11:   警告:不推荐使用“__textcoal_nt”部分

      每次我开始时,
    1. bus error都会关闭程序:
    2.   

      渲染(4个超级样本)0.39%[1] 21811总线错误./smallpt

      当我评论核心线(第279行)时:

      SingleRay = SingleRay + radiance(SRay(Camera.m_Origin+RandDir * Scale, RandDir.normalize()), 0) * (1.0/SampleNum);

      程序在没有bus error的情况下结束(并生成暗图像)。

      我没有看到任何非法内存访问,它有什么问题以及如何解决它(在g++中)?

      我将erand48()替换为自定义的。 (可能无关紧要)

      $ g++ -v
      Using built-in specs.
      COLLECT_GCC=g++-6
      COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/6.2.0/libexec/gcc/x86_64-apple-darwin16.0.0/6.2.0/lto-wrapper
      Target: x86_64-apple-darwin16.0.0
      Configured with: ../configure --build=x86_64-apple-darwin16.0.0 --prefix=/usr/local/Cellar/gcc/6.2.0 --libdir=/usr/local/Cellar/gcc/6.2.0/lib/gcc/6 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-6 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --with-build-config=bootstrap-debug --disable-werror --with-pkgversion='Homebrew gcc 6.2.0 --without-multilib' --with-bugurl=https://github.com/Homebrew/homebrew/issues --enable-plugin --disable-nls --disable-multilib
      Thread model: posix
      gcc version 6.2.0 (Homebrew gcc 6.2.0 --without-multilib)
      

0 个答案:

没有答案