Peter Dalgaard <[EMAIL PROTECTED]> writes: > Gavin Simpson <[EMAIL PROTECTED]> writes: .... > > So far so good with FC4, gcc4, gfortran and R! > > The problem affecting the Fedora Extras RPM is still there with the > new compilers though: > > -Wp,-D_FORTIFY_SOURCE=2 > > combined with -O or -O2 causes a strange printing bug: > > > matrix(list(pi)) > [,1] > [1,] > > (You don't have to use that option of course, but it suggests that not > all is well with the optimizer. And the Fedora maintainer seem set on > using it, which is a bit of a problem.)
I'm fairly sure by now that this is actually a bug in R, not gcc. We have the same internal buffer structure used in EncodeReal and in Rsprintf, and the return value of the former is buffer->data which is reallocated by the latter. That means that constructions of the form pbuf = Rsprintf("%s", EncodeReal(REAL(tmp)[0], w, d, e, OutDec)); are playing with fire. There are quite a few other similar constructions involving Encode*. I suspect is is necessary to copy the result of EncodeReal(REAL(tmp)[0], w, d, e, OutDec) to temp storage, or - probably easier - use a separate buffer for Rsprintf. -- O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel