1

我正在研究Kevin Beason 的 smallpt

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

但它在以下情况下并不顺利g++ -fopenmp smallpt.cpp

  1. 重复警告(编译成功):

/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每次我启动时都会关闭程序:

渲染(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)
4

0 回答 0