From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeroen Hofstee Date: Tue, 14 Jan 2014 18:56:44 +0100 Subject: [U-Boot] Bug in TOP860 code with gcc 4.8.1 In-Reply-To: <52D52097.6050001@emk-elektronik.de> References: <20140113210446.903E33821F4@gemini.denx.de> <52D52097.6050001@emk-elektronik.de> Message-ID: <52D57A5C.8020909@myspectrum.nl> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Reinhard, On 01/14/2014 12:33 PM, Reinhard Meyer wrote: > Dear Wolfgang, >> Dear Reinhard, >> >> attempting to build the TOP860 code with a GCC 4.8.1 based tool chain >> (say ELDK v5.5 or Yocto 1.5) gives the following errors: >> >> -> ./MAKEALL TOP860 >> Configuring for TOP860 board... >> text data bss dec hex filename >> 165471 21020 17316 203807 31c1f ./u-boot >> ../common/flash.c: In function 'flash_init': >> ../common/flash.c:336:20: warning: iteration 128u invokes undefined >> behavior [-Waggressive-loop-optimizations] >> info->start[i] = (ulong)addr + 0x10000 * i; >> ^ >> ../common/flash.c:334:4: note: containing loop >> for (i = 0; i < info->sector_count; i++) >> ^ >> ... >> >> Can you please provide a fix - or is this old hardware and the code >> should be removed from the U-Boot tree? > 1. on first and second glance I cannot see where this (simple!!) loop > might "invoke undefined behaviour". Seems like a compiler/optimizer > bug to me... > > 2. should not the same issue arise with TOP5200 (using the same > flash.c) ?? > > 3. nevertheless TOP860 can be removed. It is out of bounds: include/configs/TOP860.h:#define CONFIG_SYS_MAX_FLASH_SECT 128 /* max number of sectors on one chip */ include/configs/TOP5200.h:#define CONFIG_SYS_MAX_FLASH_SECT 256 /* max num of sects on one chip */ Removing will work as well of course ;) Regards, Jeroen