* using log directory ‘/data/gannet/ripley/R/packages/tests-clang-SAN/rcss.Rcheck’ * using R Under development (unstable) (2020-03-30 r78112) * using platform: x86_64-pc-linux-gnu (64-bit) * using session charset: UTF-8 * using option ‘--no-stop-on-test-error’ * checking for file ‘rcss/DESCRIPTION’ ... OK * checking extension type ... Package * this is package ‘rcss’ version ‘1.8’ * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking whether package ‘rcss’ can be installed ... [536s/253s] OK * checking package directory ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking compiled code ... OK * checking examples ... ERROR Running examples in ‘rcss-Ex.R’ failed The error most likely occurred in: > ### Name: FastAddDual > ### Title: Fast additive duals > ### Aliases: FastAddDual > > ### ** Examples > > ## Bermuda put option > grid <- as.matrix(cbind(rep(1, 81), c(seq(20, 60, length = 81)))) > disturb <- array(0, dim = c(2, 2, 100)) > disturb[1, 1,] <- 1 > quantile <- qnorm(seq(0, 1, length = (100 + 2))[c(-1, -(100 + 2))]) > disturb[2, 2,] <- exp((0.06 - 0.5 * 0.2^2) * 0.02 + 0.2 * sqrt(0.02) * quantile) > weight <- rep(1 / 100, 100) > control <- matrix(c(c(1, 2),c(1, 1)), nrow = 2) > reward <- array(data = 0, dim = c(81, 2, 2, 2, 50)) > in_money <- grid[, 2] <= 40 > reward[in_money, 1, 2, 2,] <- 40 > reward[in_money, 2, 2, 2,] <- -1 > for (tt in 1:50){ + reward[,,2,2,tt] <- exp(-0.06 * 0.02 * (tt - 1)) * reward[,,2,2,tt] + } > scrap <- array(data = 0, dim = c(81, 2, 2)) > scrap[in_money, 1, 2] <- 40 > scrap[in_money, 2, 2] <- -1 > scrap[,,2] <- exp(-0.06 * 0.02 * 50) * scrap[,,2] > r_index <- matrix(c(2, 2), ncol = 2) > bellman <- FastBellman(grid, reward, scrap, control, disturb, weight, r_index) At dec: 50...49...48...47...46...45...44...43...42...41...40...39...38...37...36...35...34...33...32...31...30...29...28...27...26...25...24...23...22...21...20...19...18...17...16...15...14...13...12...11...10...9...8...7...6...5...4...3...2...1...0...Done. > suppressWarnings(RNGversion("3.5.0")) > set.seed(12345) > start <- c(1, 36) ## starting state > path_disturb <- array(0, dim = c(2, 2, 100, 50)) > path_disturb[1, 1,,] <- 1 > rand1 <- rnorm(100 * 50 / 2) > rand1 <- as.vector(rbind(rand1, -rand1)) ## anti-thetic disturbances > path_disturb[2, 2,,] <- exp((0.06 - 0.5 * 0.2^2) * 0.02 + 0.2 * sqrt(0.02) * rand1) > path <- PathDisturb(start, path_disturb) > ## Reward function > RewardFunc <- function(state, time) { + output <- array(data = 0, dim = c(nrow(state), 2, 2)) + output[,2, 2] <- exp(-0.06 * 0.02 * (time - 1)) * pmax(40 - state[,2], 0) + return(output) + } > policy <- FastPathPolicy(path, grid, control, RewardFunc, bellman$expected) > ## Scrap function > ScrapFunc <- function(state) { + output <- array(data = 0, dim = c(nrow(state), 2)) + output[,2] <- exp(-0.06 * 0.02 * 50) * pmax(40 - state[,2], 0) + return(output) + } > ## Subsimulation disturbances > subsim <- array(0, dim = c(2, 2, 100, 100, 50)) > subsim[1,1,,,] <- 1 > rand2 <- rnorm(100 * 100 * 50 / 2) > rand2 <- as.vector(rbind(rand2, -rand2)) > subsim[2,2,,,] <- exp((0.06 - 0.5 * 0.2^2) * 0.02 + 0.2 * sqrt(0.02) * rand2) > subsim_weight <- rep(1 / 100, 100) > ## Additive duals > mart <- FastAddDual(path, subsim, subsim_weight, grid, bellman$value, ScrapFunc) Additive duals at dec: 0...1...2...3...4...5...6...7...================================================================= ==25756==ERROR: AddressSanitizer: heap-use-after-free on address 0x62e0002ac408 at pc 0x0000006008d8 bp 0x7ffffd04e050 sp 0x7ffffd04e048 READ of size 8 at 0x62e0002ac408 thread T0 #0 0x6008d7 in coerceToReal /data/gannet/ripley/R/svn/R-devel/src/main/coerce.c:575:5 #1 0x6008d7 in Rf_coerceVector /data/gannet/ripley/R/svn/R-devel/src/main/coerce.c:1277:12 #2 0x7f29cf5b059e in SEXPREC* Rcpp::internal::basic_cast<14>(SEXPREC*) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/r_cast.h:67:24 #3 0x7f29cf635645 in SEXPREC* Rcpp::internal::r_true_cast<14>(SEXPREC*) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/r_cast.h:91:20 #4 0x7f29cf635645 in SEXPREC* Rcpp::r_cast<14>(SEXPREC*) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/r_cast.h:176:20 #5 0x7f29cf635645 in void Rcpp::internal::export_indexing__impl, unsigned int>(SEXPREC*, arma::Col&, Rcpp::traits::integral_constant) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/export.h:122:20 #6 0x7f29cf635461 in void Rcpp::internal::export_indexing__dispatch, unsigned int>(SEXPREC*, arma::Col&, Rcpp::traits::r_type_primitive_tag) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/export.h:132:4 #7 0x7f29cf635461 in void Rcpp::internal::export_indexing, unsigned int>(SEXPREC*, arma::Col&) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/export.h:155:4 #8 0x7f29cf635461 in Rcpp::traits::IndexingExporter, unsigned int>::get() /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/Exporter.h:64:17 #9 0x7f29cf638e38 in arma::Col Rcpp::internal::as >(SEXPREC*, Rcpp::traits::r_type_generic_tag) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/as.h:89:29 #10 0x7f29cf638e38 in arma::Col Rcpp::as >(SEXPREC*) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/as.h:152:16 #11 0x7f29cf638e38 in FastAddDual(arma::Cube const&, Rcpp::Vector<14, Rcpp::PreserveStorage>, arma::Col const&, arma::Mat const&, Rcpp::Vector<14, Rcpp::PreserveStorage>, Rcpp::Function_Impl, Rcpp::Function_Impl) /data/gannet/ripley/R/packages/tests-clang-SAN/rcss/src/fast_add_dual.cpp:57:17 #12 0x7f29cf588882 in _rcss_FastAddDual /data/gannet/ripley/R/packages/tests-clang-SAN/rcss/src/RcppExports.cpp:117:34 #13 0x6e0d4f in R_doDotCall /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:619:17 #14 0x72c6a9 in do_dotcall /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:1280:11 #15 0x8417d0 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7090:14 #16 0x821799 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:723:8 #17 0x889ceb in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c #18 0x885147 in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1814:16 #19 0x8225d2 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:846:12 #20 0x8965e3 in do_set /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2956:8 #21 0x821dec in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:798:12 #22 0x956f79 in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:264:2 #23 0x95b3e0 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:314:11 #24 0x95b1c5 in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1113:5 #25 0x4dbb4a in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29:5 #26 0x7f29e0740f42 in __libc_start_main (/lib64/libc.so.6+0x23f42) #27 0x43036d in _start (/data/gannet/ripley/R/R-clang-SAN/bin/exec/R+0x43036d) 0x62e0002ac408 is located 8 bytes inside of 40048-byte region [0x62e0002ac400,0x62e0002b6070) freed by thread T0 here: #0 0x4a95fd in free /data/gannet/ripley/Sources/LLVM/10.0.0/llvm-10.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:123:3 #1 0x99829e in ReleaseLargeFreeVectors /data/gannet/ripley/R/svn/R-devel/src/main/memory.c:1114:7 #2 0x99829e in RunGenCollect /data/gannet/ripley/R/svn/R-devel/src/main/memory.c:1896:5 #3 0x970e9c in R_gc_internal /data/gannet/ripley/R/svn/R-devel/src/main/memory.c:3125:19 #4 0x976aea in Rf_allocVector3 /data/gannet/ripley/R/svn/R-devel/src/main/memory.c:2775:2 #5 0x5f8f16 in Rf_allocVector /data/gannet/ripley/R/svn/R-devel/src/include/Rinlinedfuns.h:593:12 #6 0x5f8f16 in coerceToReal /data/gannet/ripley/R/svn/R-devel/src/main/coerce.c:567:5 #7 0x5f8f16 in Rf_coerceVector /data/gannet/ripley/R/svn/R-devel/src/main/coerce.c:1277:12 #8 0x7f29cf5b059e in SEXPREC* Rcpp::internal::basic_cast<14>(SEXPREC*) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/r_cast.h:67:24 #9 0x7f29cf635645 in SEXPREC* Rcpp::internal::r_true_cast<14>(SEXPREC*) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/r_cast.h:91:20 #10 0x7f29cf635645 in SEXPREC* Rcpp::r_cast<14>(SEXPREC*) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/r_cast.h:176:20 #11 0x7f29cf635645 in void Rcpp::internal::export_indexing__impl, unsigned int>(SEXPREC*, arma::Col&, Rcpp::traits::integral_constant) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/export.h:122:20 #12 0x7f29cf635461 in void Rcpp::internal::export_indexing__dispatch, unsigned int>(SEXPREC*, arma::Col&, Rcpp::traits::r_type_primitive_tag) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/export.h:132:4 #13 0x7f29cf635461 in void Rcpp::internal::export_indexing, unsigned int>(SEXPREC*, arma::Col&) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/export.h:155:4 #14 0x7f29cf635461 in Rcpp::traits::IndexingExporter, unsigned int>::get() /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/Exporter.h:64:17 #15 0x7f29cf638e38 in arma::Col Rcpp::internal::as >(SEXPREC*, Rcpp::traits::r_type_generic_tag) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/as.h:89:29 #16 0x7f29cf638e38 in arma::Col Rcpp::as >(SEXPREC*) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/as.h:152:16 #17 0x7f29cf638e38 in FastAddDual(arma::Cube const&, Rcpp::Vector<14, Rcpp::PreserveStorage>, arma::Col const&, arma::Mat const&, Rcpp::Vector<14, Rcpp::PreserveStorage>, Rcpp::Function_Impl, Rcpp::Function_Impl) /data/gannet/ripley/R/packages/tests-clang-SAN/rcss/src/fast_add_dual.cpp:57:17 #18 0x7f29cf588882 in _rcss_FastAddDual /data/gannet/ripley/R/packages/tests-clang-SAN/rcss/src/RcppExports.cpp:117:34 #19 0x6e0d4f in R_doDotCall /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:619:17 #20 0x72c6a9 in do_dotcall /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:1280:11 #21 0x8417d0 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7090:14 #22 0x821799 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:723:8 #23 0x889ceb in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c #24 0x885147 in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1814:16 #25 0x8225d2 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:846:12 #26 0x8965e3 in do_set /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2956:8 #27 0x821dec in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:798:12 #28 0x956f79 in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:264:2 #29 0x95b3e0 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:314:11 #30 0x95b1c5 in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1113:5 #31 0x4dbb4a in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29:5 #32 0x7f29e0740f42 in __libc_start_main (/lib64/libc.so.6+0x23f42) previously allocated by thread T0 here: #0 0x4a987d in malloc /data/gannet/ripley/Sources/LLVM/10.0.0/llvm-10.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3 #1 0x976e41 in Rf_allocVector3 /data/gannet/ripley/R/svn/R-devel/src/main/memory.c:2806:7 #2 0x7f29cfb1d101 in SEXPREC* Rcpp::internal::primitive_range_wrap__impl__nocast(int const*, int const*, std::__1::random_access_iterator_tag) /data/gannet/ripley/R/test-clang/Rcpp/include/Rcpp/internal/wrap.h:116:28 SUMMARY: AddressSanitizer: heap-use-after-free /data/gannet/ripley/R/svn/R-devel/src/main/coerce.c:575:5 in coerceToReal Shadow bytes around the buggy address: 0x0c5c8004d830: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c5c8004d840: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c5c8004d850: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c5c8004d860: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c5c8004d870: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c5c8004d880: fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c5c8004d890: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c5c8004d8a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c5c8004d8b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c5c8004d8c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0c5c8004d8d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==25756==ABORTING * checking for detritus in the temp directory ... OK * DONE Status: 1 ERROR See ‘/data/gannet/ripley/R/packages/tests-clang-SAN/rcss.Rcheck/00check.log’ for details. Command exited with non-zero status 1 Time 5:04.38, 559.43 + 17.54