From: Matthias Fuchs Date: Thu, 7 Dec 2006 17:55:27 +0100 Subject: [U-Boot-Users] possible ELDK4 gcc compiler bug In-Reply-To: References: Message-ID: <200612071755.27873.matthias.fuchs@esd-electronics.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thursday 07 December 2006 17:42, Rune Torgersen wrote: > > -----Original Message----- > > From: Matthias Fuchs > > *)FPGA_BA; > > Making 'fpga' static solves the problem. But why? > > > > Making it volatile will solve it. I tried that - of course. But it didn't solve the problem. > > The reason is that the ctrl member is not used anywhere else (except for > some printf's) sothe compiler just strores the value in a register an > optimizes away the access to the datastructure (and your hardware). > By making it volatile, you force the compiler to never optimize away the > accesses. > > BTW. your original code would probably have worked with -O0 > optimizattion level. Yes, it does. Matthias -- ----------------------------------------------------------------------- Dipl.-Ing. Matthias Fuchs esd electronic system design gmbh http://www.esd-electronics.com Vahrenwalder Str. 207 phone: +49-511-37298-0, fax: -68 30165 Hannover, Germany -----------------------------------------------------------------------