Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve CRAN issues from Rcpp with UBSAN #76

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

david-cortes
Copy link
Contributor

This PR should fix the UBSAN issues reported by CRAN:
image

``` > test_check("rsparse") /data/gannet/ripley/R/test-dev/Rcpp/include/Rcpp/vector/traits.h:46:46: runtime error: reference binding to misaligned address 0x000000000001 for type 'type', which requires 4 byte alignment 0x000000000001: note: pointer points here #0 0x7f9168fd9f25 in Rcpp::traits::r_vector_cache<13, Rcpp::PreserveStorage>::ref(long) /data/gannet/ripley/R/test-dev/Rcpp/include/Rcpp/vector/traits.h:46 #1 0x7f9168fd9f25 in Rcpp::Vector<13, Rcpp::PreserveStorage>::operator[](long) /data/gannet/ripley/R/test-dev/Rcpp/include/Rcpp/vector/Vector.h:340 #2 0x7f9168fd9f25 in extract_float_vector(Rcpp::S4_Impl) /data/gannet/ripley/R/packages/tests-gcc-SAN/rsparse/src/utils.cpp:124 #3 0x7f916907dc44 in als_implicit_float(Rcpp::S4_Impl const&, Rcpp::S4_Impl&, Rcpp::S4_Impl&, Rcpp::S4_Impl&, double, int, unsigned int, unsigned int, bool, bool, double, Rcpp::S4_Impl&, bool) /data/gannet/ripley/R/packages/tests-gcc-SAN/rsparse/src/wrmf_implicit.cpp:27 #4 0x7f9168ec9a08 in _rsparse_als_implicit_float /data/gannet/ripley/R/packages/tests-gcc-SAN/rsparse/src/RcppExports.cpp:413 #5 0x58bccb in R_doDotCall /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:813 #6 0x653b17 in bcEval_loop /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:8690 #7 0x68e822 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7523 #8 0x68f09a in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1167 #9 0x694dfe in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2398 #10 0x697268 in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2311 #11 0x68f6ad in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2333 #12 0x68f6ad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1285 #13 0x69988b in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3009 #14 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237 #15 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237 #16 0x69988b in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3009 #17 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237 #18 0x694dfe in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2398 #19 0x697268 in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2311 #20 0x68f6ad in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2333 #21 0x68f6ad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1285 #22 0x69d4b7 in do_set /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3581 #23 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237 #24 0x69988b in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3009 #25 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237 #26 0x6a5ecc in do_for /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2891 #27 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237 #28 0x69988b in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3009 #29 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237 #30 0x694dfe in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2398 #31 0x697268 in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2311 #32 0x68f6ad in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2333 #33 0x68f6ad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1285 #34 0x69d4b7 in do_set /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3581 #35 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237 #36 0x69988b in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3009 #37 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237 #38 0x6a5ecc in do_for /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2891 #39 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237 #40 0x69988b in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3009 #41 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237 #42 0x6a0fe2 in do_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3955 #43 0x64de4f in bcEval_loop /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:8140 #44 0x68e822 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7523 #45 0x68f09a in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1167 #46 0x694dfe in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2398 #47 0x697268 in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2311 #48 0x68f6ad in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2333 #49 0x68f6ad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1285 #50 0x6a1e37 in do_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3973 #51 0x64de4f in bcEval_loop /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:8140 #52 0x68e822 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7523 #53 0x68f09a in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1167 #54 0x694dfe in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2398 #55 0x697268 in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2311 #56 0x69e493 in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2333 #57 0x69e493 in R_forceAndCall /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2465 #58 0x451404 in do_lapply /data/gannet/ripley/R/svn/R-devel/src/main/apply.c:75 #59 0x7420d7 in do_internal /data/gannet/ripley/R/svn/R-devel/src/main/names.c:1409 #60 0x63f4f9 in bcEval_loop /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:8160 #61 0x68e822 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7523 #62 0x68f09a in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1167 #63 0x694dfe in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2398 #64 0x697268 in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2311 #65 0x68f6ad in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2333 #66 0x68f6ad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1285 #67 0x714e9e in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:263 #68 0x715511 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:315 #69 0x715654 in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1217 #70 0x7156a2 in Rf_mainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1224 #71 0x41a7d8 in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29 #72 0x7f917ec2950f in __libc_start_call_main (/lib64/libc.so.6+0x2950f) (BuildId: 8257ee907646e9b057197533d1e4ac8ede7a9c5c) #73 0x7f917ec295c8 in __libc_start_main_alias_2 (/lib64/libc.so.6+0x295c8) (BuildId: 8257ee907646e9b057197533d1e4ac8ede7a9c5c) #74 0x41d034 in _start (/data/gannet/ripley/R/gcc-SAN/bin/exec/R+0x41d034) (BuildId: 56ff6b70c40a24eccf16f0ce952f5ebd85884520)

/data/gannet/ripley/R/test-dev/Rcpp/include/Rcpp/vector/Vector.h:340:62: runtime error: reference binding to misaligned address 0x000000000001 for type 'type', which requires 4 byte alignment
0x000000000001: note: pointer points here

#0 0x7f9168fd9ee9 in Rcpp::Vector<13, Rcpp::PreserveStorage>::operator /data/gannet/ripley/R/test-dev/Rcpp/include/Rcpp/vector/Vector.h:340
#1 0x7f9168fd9ee9 in extract_float_vector(Rcpp::S4_ImplRcpp::PreserveStorage) /data/gannet/ripley/R/packages/tests-gcc-SAN/rsparse/src/utils.cpp:124
#2 0x7f916907dc44 in als_implicit_float(Rcpp::S4_ImplRcpp::PreserveStorage const&, Rcpp::S4_ImplRcpp::PreserveStorage&, Rcpp::S4_ImplRcpp::PreserveStorage&, Rcpp::S4_ImplRcpp::PreserveStorage&, double, int, unsigned int, unsigned int, bool, bool, double, Rcpp::S4_ImplRcpp::PreserveStorage&, bool) /data/gannet/ripley/R/packages/tests-gcc-SAN/rsparse/src/wrmf_implicit.cpp:27
#3 0x7f9168ec9a08 in _rsparse_als_implicit_float /data/gannet/ripley/R/packages/tests-gcc-SAN/rsparse/src/RcppExports.cpp:413
#4 0x58bccb in R_doDotCall /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:813
#5 0x653b17 in bcEval_loop /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:8690
#6 0x68e822 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7523
#7 0x68f09a in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1167
#8 0x694dfe in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2398
#9 0x697268 in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2311
#10 0x68f6ad in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2333
#11 0x68f6ad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1285
#12 0x69988b in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3009
#13 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237
#14 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237
#15 0x69988b in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3009
#16 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237
#17 0x694dfe in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2398
#18 0x697268 in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2311
#19 0x68f6ad in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2333
#20 0x68f6ad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1285
#21 0x69d4b7 in do_set /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3581
#22 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237
#23 0x69988b in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3009
#24 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237
#25 0x6a5ecc in do_for /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2891
#26 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237
#27 0x69988b in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3009
#28 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237
#29 0x694dfe in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2398
#30 0x697268 in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2311
#31 0x68f6ad in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2333
#32 0x68f6ad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1285
#33 0x69d4b7 in do_set /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3581
#34 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237
#35 0x69988b in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3009
#36 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237
#37 0x6a5ecc in do_for /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2891
#38 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237
#39 0x69988b in do_begin /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3009
#40 0x68fad8 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1237
#41 0x6a0fe2 in do_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3955
#42 0x64de4f in bcEval_loop /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:8140
#43 0x68e822 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7523
#44 0x68f09a in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1167
#45 0x694dfe in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2398
#46 0x697268 in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2311
#47 0x68f6ad in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2333
#48 0x68f6ad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1285
#49 0x6a1e37 in do_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:3973
#50 0x64de4f in bcEval_loop /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:8140
#51 0x68e822 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7523
#52 0x68f09a in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1167
#53 0x694dfe in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2398
#54 0x697268 in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2311
#55 0x69e493 in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2333
#56 0x69e493 in R_forceAndCall /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2465
#57 0x451404 in do_lapply /data/gannet/ripley/R/svn/R-devel/src/main/apply.c:75
#58 0x7420d7 in do_internal /data/gannet/ripley/R/svn/R-devel/src/main/names.c:1409
#59 0x63f4f9 in bcEval_loop /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:8160
#60 0x68e822 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7523
#61 0x68f09a in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1167
#62 0x694dfe in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2398
#63 0x697268 in applyClosure_core /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2311
#64 0x68f6ad in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2333
#65 0x68f6ad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1285
#66 0x714e9e in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:263
#67 0x715511 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:315
#68 0x715654 in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1217
#69 0x7156a2 in Rf_mainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1224
#70 0x41a7d8 in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29
#71 0x7f917ec2950f in __libc_start_call_main (/lib64/libc.so.6+0x2950f) (BuildId: 8257ee907646e9b057197533d1e4ac8ede7a9c5c)
#72 0x7f917ec295c8 in __libc_start_main_alias_2 (/lib64/libc.so.6+0x295c8) (BuildId: 8257ee907646e9b057197533d1e4ac8ede7a9c5c)
#73 0x41d034 in _start (/data/gannet/ripley/R/gcc-SAN/bin/exec/R+0x41d034) (BuildId: 56ff6b70c40a24eccf16f0ce952f5ebd85884520)

</details>

Copy link
Owner

@dselivanov dselivanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @david-cortes ! I've received email from CRAN to fix this, but had zero spare time to dig into it. Appreciate your continuous contributions !

@dselivanov dselivanov merged commit d58ece2 into dselivanov:master Jun 28, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants