[LEDE-DEV] [PATCH] gcc: 7.2: remove mips patch causing broken code

Felix Fietkau nbd at nbd.name
Mon Dec 18 00:40:03 PST 2017


On 2017-12-17 22:21, Hauke Mehrtens wrote:
> This patch made GCC produce broken code, remove it.
> In mp_cmp_d() function in th libtommath shipped with dropbear the
> following code was compiled wrong:
> 
> /* compare based on magnitude */
> if (a->used > 1) {
>   return 1;
> }
> 
> In the broken ASM this part returned -1 like the previous return
> statement did instead of 1 like it should.
> 
> This did not happen when the -funroll-loops option was given to GCC.
> 
> Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
This patch only passes the cost associated with branches and memory
transfers to other parts of GCC, which causes it to generate different
code (matching what it already does on -O2).
I'm pretty sure that by removing the patch you're simply hiding the real
issue which can easily creep in again in other places when compiling
with -O2. I don't think we can trust GCC 7 on MIPS before we find and
fix the real bug.

- Felix



More information about the Lede-dev mailing list