This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Optimizer problem with repeated loops over memory


Bernd Jendrissek wrote:
On Tue, May 13, 2008 at 9:13 PM, Nick Spence <nick.spence@freescale.com> wrote:
       addr = 0;
       for (i = 0; i < 16; i++) *(addr++) = 0;

I got a conditional jump by replacing your initialization of addr with:


asm("" : "=g" (addr) : "0" (0));

That should make the NULL-ness of addr invisible to GCC.

Thanks - I ended up loading the value from a DRAM base address register, which effectively hid it from the optimizer.


I still don't like the silent corruption of code by the optimizer, and would like to see an optimizer warning message added.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]