From patchwork Sat Feb 2 14:05:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot] U-Boot Bug with newer GCC Date: Sat, 02 Feb 2013 04:05:18 -0000 From: Jeroen Hofstee X-Patchwork-Id: 217666 Message-Id: <510D1D1E.7080705@myspectrum.nl> To: Albert ARIBAUD Cc: Marek Vasut , Jeroen Hofstee , "u-boot@lists.denx.de" , "Priebe, Sebastian" , Heiko Schocher Hello Albert, On 02/02/2013 12:32 PM, Albert ARIBAUD wrote: > >>> >>> Sebastian wrote On 01.02.2013 08:55: >>>> we are using u-boot in our embedded system with arm-1136jfs cpu. >>>> We recently tried a new toolchain with GCC 4.7.2. >>>> If compiled with the new toolchain the feature CONFIG_AUTO_COMPLETE isn't working. > [..] AFAIK it has never been seen on mainline code, The twister board from mainline / current master also has this problem. I believe the mt_ventoux will have it as well, but can't test it. > and has been very elusive for those who experience it -- enabling debug > or simply adding/removing code makes it go away or reappear, leading me > to thinking that some of the added code either does a data abort itself, > or causes one in the mainline code it calls upon. yes, it is confusing. The following patch will e.g. make the trap go away on the twister. Yet there is nothing wrong with the original code it touches (or I fail to see what it is). Regards, Jeroen const char *cmd; @@ -224,11 +223,7 @@ static int complete_cmdv(int argc, char * const argv[], char last_char, int maxv * Some commands allow length modifiers (like "cp.b"); * compare command name only until first dot. */ - p = strchr(cmd, '.'); - if (p == NULL) - len = strlen(cmd); - else - len = p - cmd; + len = strlen(cmd); /* return the partial matches */ for (; cmdtp != cmdend; cmdtp++) { diff --git a/common/command.c b/common/command.c index 50c8429..520bd39 100644 --- a/common/command.c +++ b/common/command.c @@ -185,7 +185,6 @@ static int complete_cmdv(int argc, char * const argv[], char last_char, int maxv cmd_tbl_t *cmdtp = ll_entry_start(cmd_tbl_t, cmd); const int count = ll_entry_count(cmd_tbl_t, cmd); const cmd_tbl_t *cmdend = cmdtp + count; - const char *p; int len, clen; int n_found = 0;