Hi Ivan,

This is extremely helpful! I appreciate your time and detailed explanation.

Tracy


> On May 8, 2025, at 6:30 PM, Ivan Krylov <ikry...@disroot.org> wrote:
> 
> В Thu, 8 May 2025 12:01:47 -0400
> Tracy Morrison Sweet <tsw...@umd.edu> пишет:
> 
>> New submission 
>> Package was archived on CRAN
>> 
>> I’m not sure how to do anything to remove this note.
> 
> This note is to be expected.
> 
>> In process.txt and summary.txt, it says "File: HLSM-Ex.Rout
>> vendor/cigraph/src/constructors/adjacency.c:87:34: runtime error: nan
>> is outside the range of representable values of type ‘long’"
> 
> The link to the original issue that got your package archived is more
> informative because it contains the backtrace and shows the place in
> your examples where the problem happens:
> 
> https://www.stats.ox.ac.uk/pub/bdr/memtests/clang-UBSAN/HLSM/HLSM-Ex.Rout
> 
>>> fixed.fit = HLSMfixedEF(Y = ps.advice.mat, senderCov=ps.node.df,
>> +    initialVals = initialVals,priors = priors,
>> +    tune = tune,tuneIn = FALSE,dd = 2,niter = niter)
>> core/constructors/adjacency.c:47:26: runtime error: nan is outside
>> the range of representable values of type 'long' #0 0x7f09504c6e4b in
>> igraph_i_adjacency_directed
>> /tmp/Rtmp9HF8V2/R.INSTALL659cd504fd46b/igraph/src/core/constructors/adjacency.c:47:26
>> #1 0x7f09504c5715 in igraph_adjacency
>> /tmp/Rtmp9HF8V2/R.INSTALL659cd504fd46b/igraph/src/core/constructors/adjacency.c:212:9
>> #2 0x7f0950c654a3 in R_igraph_graph_adjacency
>> /tmp/Rtmp9HF8V2/R.INSTALL659cd504fd46b/igraph/src/rinterface_extra.c:4861:3
> 
> The file path is now different, but the issue is most likely the same.
> During a call to HLSMfixedEF(), a matrix containing a NaN value is
> passed to the 'igraph' package, where the NaN is converted to an
> integer:
> 
> https://github.com/igraph/rigraph/blob/9a2816248eb837077b5af28bad7b1b9c0713b128/src/vendor/cigraph/src/constructors/adjacency.c#L87
> 
> Unfortunately, converting a NaN into an integer is undefined behaviour
> according to the C standard. The program is allowed to do literally
> anything, so it caused your package to be archived.
> 
> Ideally, 'igraph' could produce an informative error message upon
> detecting a NaN, but you can avoid the problem on your end by making
> sure that all values in your adjacency matrices are finite before
> calling igraph::graph.adjacency().
> 
> To see the problem for yourself, you'll need a "sanitized" build of R:
> https://cran.r-project.org/doc/manuals/R-exts.html#Using-Undefined-Behaviour-Sanitizer
> 
> Sanitizers are somewhat finicky to use. The container images
> docker.io/rocker/r-devel-ubsan-clang and
> ghcr.io/r-hub/containers/clang-ubsan, or the R-hub service may help.
> 
> Good luck! If this wasn't detailed enough, don't hesitate to ask
> follow-up questions.
> 
> -- 
> Best regards,
> Ivan

Tracy M. Sweet
Associate Professor
HDQM
University of Maryland
tsw...@umd.edu
she/her/hers
UMD Land Acknowledgement 
<https://diversity.umd.edu/resources/land-acknowledgement>






        [[alternative HTML version deleted]]

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to