With the first release candidate of gcc 4.7 out, we’ve decided to get Linaro Android ready for the new compiler.

Overall, adding support for the new compiler went smoothly - in the process, we fixed 2 compiler bugs, and adapted the Android codebase to gcc 4.7’s stricter checking. In particular the C++ declaration order changes took a bit of effort.

Other than that, gcc was mainly screaming at code that should never have been valid, like this extreme fondness of variable name recycling uncovered in stagefright’s Matroska decoder:

for(size_t i=0; ...) {
    int32_t i = 0;
    while(i<20) {
        for(int i=0; ...) {

Currently, the gcc 4.7 based toolchain is available on android-buildhttps://android-build.linaro.org/builds/~linaro-android/toolchain-4.7-bzr/. 2 builds already using it – Pandaboardhttps://android-build.linaro.org/builds/~linaro-android/panda-ics-gcc47-tilt-tracking-blob/ and iMX6https://android-build.linaro.org/builds/~linaro-android/imx6-ics-gcc47-freescalelt-stable-open/ – are also available, and seem to work as expected.

Builds for additional boards will follow shortly.