Hi Robert, ----- Original Message ----- > From: "Robert Castelo" <robert.cast...@upf.edu> > To: bioc-devel@r-project.org > Sent: Thursday, June 12, 2014 5:45:28 AM > Subject: [Bioc-devel] evaluation of C post-increments changed in GCC 4.8.2 > > hi, > > this is just a warning to developers who may have C code in their > packages. > > today i fixed a problem in the C code of the package VariantFiltering > which can be reproduced with the following toy example. > > =======test.c======== > #include <stdio.h> > #include <ctype.h> > > int main(void) { > char msg[] = "Hello World!"; > char* p=msg; > > printf("%s\n", msg); > while ((*p++=tolower(*p))); > printf("%s\n", msg); > > return 0; > } > ==================== > > after compiling this program stored as 'test.c' with the GCC > compiler: > > $ gcc -o test ./test.c > > its execution shows the following output, > > $ ./test > Hello World! > hello world! > > when GCC has version 4.6.3 or lower. However, if you try to compile > it > with GCC version 4.8.2 (haven't tried any version > 4.6.3 and < > 4.8.2) > you get the following different output: > > Hello World! > ello world! > > my interpretation of this change, and probably the C gurus in the > list > can clear up this point, is that the evaluation of post-increments > (i.e., x++, i++, p++, etc.) in C has changed the way it was done in > GCC > 4.8.2 (and maybe even in earlier versions although not earlier than > 4.6.3). > > if i change the line that contains the post-increment 'p++' to the > following one: > > while ((*p=tolower(*p))) p++; > > then it works again as i expected with GCC 4.8.2. > > so, if you have C code in your package you might want to inspect all > your post-increments. actually, if you compile the C code with > -Wunsequenced the gcc compiler will warn you about this potential > problem. > > see for instance (before the fix i sent gets through the build) the > CHECK report of VariantFiltering for Mac OS X Snow Leopard and > Mavericks > which seem to use these two different flavors of GCC. While with Snow > Leopard there is no apparent problem, in Maverics the installed > version > of GCC reports the following warnings: >
Thanks for figuring this out and sharing it. Note that on the build machines, the compiler used on Mavericks is not gcc but clang. More info here: http://www.bioconductor.org/checkResults/2.14/bioc-LATEST/morelia-NodeInfo.html http://www.bioconductor.org/checkResults/3.0/bioc-LATEST/oaxaca-NodeInfo.html Dan > Found the following significant warnings: > methods-WeightMatrix.c:256:19: warning: unsequenced modification > and > access to 'q' [-Wunsequenced] > methods-WeightMatrix.c:638:17: warning: unsequenced modification > and > access to 'q' [-Wunsequenced] > > those lines contain the kind of use of post-increment i showed above > and > are the ones i had to fix. > > > greetings everyone, > > robert. > > _______________________________________________ > Bioc-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/bioc-devel > _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel