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

Problem on 32-bit Windows #17

Open
jeroen opened this issue Feb 5, 2020 · 2 comments
Open

Problem on 32-bit Windows #17

jeroen opened this issue Feb 5, 2020 · 2 comments

Comments

@jeroen
Copy link

@jeroen jeroen commented Feb 5, 2020

Hi! R on Windows recently switched to build with -mfpmath=sse -msse2 for the new GCC-8 toolchain. With this compiler flag, numeric results on 32-bit are consistent with 64-bit.

However this change seems to have revealed a bug in DDD that causes an occasional crash during the unit tests when running in 32-bit. I have narrowed down the problem to the two tests that are using bd_loglik:

r10 <- DDD::bd_loglik(pars1 = pars1,pars2 = pars2,brts = brts,missnumspec = 0,methode = 'lsoda')
expect_equal_x64(r10,-11.6076802136507471,tolerance = 1E-16)
r11 <- DDD::bd_loglik(pars1 = c(0.4,0.1,20),pars2 = c(4,0,1,0,2), brts = 1:10, missnumspec = 0)
expect_equal_x64(r11,-27.7337684064852610,tolerance = 1E-16)

If I comment out these tests on 32-bit, everything is OK. Would you have any guess on where in the code you may make memory assumptions on 32-bit floats that may not overlfloat icw/ -mfpmath=sse ?

32-bit is not widely used anymore, so if you think it's not important you can also just skip the test on 32-bit platforms. I see you are already ignoring the result for 32-bit on these platforms, so there I'm guessing this only works on 64-bit anyway.

You can reproduce the problem by downloading r-testing for Windows, or by submitting to R-devel ATC (alternative toolchain) on WinBuilder.

@jeroen

This comment has been minimized.

Copy link
Author

@jeroen jeroen commented Feb 5, 2020

Update the above post (my earlier diagnosis was incorrect, the problematic function is bd_loglik.

@jeroen

This comment has been minimized.

Copy link
Author

@jeroen jeroen commented Feb 6, 2020

I think it has to do with this compiler warning that I see when compiling with -Wall:

gfortran  -fPIC  -Wall -g -O2  -c  dd_loglik_rhs_FORTRAN.f95 -o dd_loglik_rhs_FORTRAN.o
dd_loglik_rhs_FORTRAN.f95:305:11:

       En = SUM(Envec)
           1
Warning: Possible change of value in conversion from REAL(16) to REAL(8) at (1) [-Wconversion]

I think the crash happens because you stick a quad precision REAL(16) :: Envec(N - kk) into a double.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.