All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] Bug in TOP860 code with gcc 4.8.1
@ 2014-01-13 21:04 Wolfgang Denk
  2014-01-14 11:33 ` Reinhard Meyer
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2014-01-13 21:04 UTC (permalink / raw)
  To: u-boot

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?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Life would be so much easier if everyone read the manual.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] Bug in TOP860 code with gcc 4.8.1
  2014-01-13 21:04 [U-Boot] Bug in TOP860 code with gcc 4.8.1 Wolfgang Denk
@ 2014-01-14 11:33 ` Reinhard Meyer
  2014-01-14 17:56   ` Jeroen Hofstee
  0 siblings, 1 reply; 4+ messages in thread
From: Reinhard Meyer @ 2014-01-14 11:33 UTC (permalink / raw)
  To: u-boot

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.

Best Regards,
Reinhard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] Bug in TOP860 code with gcc 4.8.1
  2014-01-14 11:33 ` Reinhard Meyer
@ 2014-01-14 17:56   ` Jeroen Hofstee
  2014-01-15  9:08     ` Reinhard Meyer
  0 siblings, 1 reply; 4+ messages in thread
From: Jeroen Hofstee @ 2014-01-14 17:56 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] Bug in TOP860 code with gcc 4.8.1
  2014-01-14 17:56   ` Jeroen Hofstee
@ 2014-01-15  9:08     ` Reinhard Meyer
  0 siblings, 0 replies; 4+ messages in thread
From: Reinhard Meyer @ 2014-01-15  9:08 UTC (permalink / raw)
  To: u-boot

Hello Jeroen,
> 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
I see. Because of the common code with TOP5200, there is potentially a 
larger flash chip available in the switch, which would cause undefined 
behaviour later. However TOP860 has never seen more than 2MB of flash :) 
so there is no actual danger.

For the next few weeks I do not have the capacity to provide a patch, 
and since the TOP860 U-Boot is frozen to a very old state by the 
customers anyway, it is save to be removed from the current tree.

Best Regards
Reinhard

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-15  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-13 21:04 [U-Boot] Bug in TOP860 code with gcc 4.8.1 Wolfgang Denk
2014-01-14 11:33 ` Reinhard Meyer
2014-01-14 17:56   ` Jeroen Hofstee
2014-01-15  9:08     ` Reinhard Meyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.