[ELDK] ELDK 5.1.1: GCC 4.6.1 optimization settings generating invalid computation order/results.

Patrick O'Halloran pohalloran at gmail.com
Tue Mar 13 18:57:05 CET 2012


Hi Wolfgang,

We have been working with your ELDK 5.1.1 toolchain (powerpc-4xx) for some
weeks now, and had noticed inconsistent behavior between our old firmware
image (generated with ELDK 4.1) and new firmware image (generated with ELDK
5.1.1).
Specifically we were seeing inconsistent results from one particular code
block which was doing quite a bit of bit manipulation.

Tracking down the cause has been an interesting endeavor. But what it is
pointing to is invalid/or mis-ordered operations when the following flags
are set in optimization with GCC 4.6.1 as provided with ELDK 5.1.1.
These flags are enabled by default at all optimization levels:  -ftree-ccp
and -ftree-bit-ccp.
Therefore to prevent these operations affecting other code behaviour, we
have added the relevant settings to disable this behaviour (using the -fno
flags) as shown below.
We are advising internally in our development group that the following
flags be added to CFLAGS when building any code with the ELDK 5.1.1
    OPP_FLAG_SETTINGS = -fno-tree-ccp -fno-tree-bit-ccp
These settings have been validated with our firmware (including Linux
Kernel) and we have verified that the old firmware generated image
(generated with ELDK 4.1) and newly generated image (generated with ELDK
5.1.1) are behaving identically on our regression test suite.

Don't know if this is related to the following:

   - http://comments.gmane.org/gmane.comp.gcc.bugs/338704
   - http://comments.gmane.org/gmane.comp.gcc.bugs/304411

This is our current workaround, and planned development path. However, we
wanted to know if you had seen similar issues, or know of other means of
configuring GCC to use this as default behavior rather than adding to flags
to each makefile/build scripts.
Also, how are the prebuilt images built (glibc, gdb, etc) i.e. assuming
some optimization level enabled.

Any feedback, or input welcome.
Best Regards,
Patrick


More information about the eldk mailing list