GNU bug report logs - #40737
Segfault in arm gcc7, thumb2 builroot, with arm patch

Previous Next

Package: guile;

Reported by: dsmich <at> roadrunner.com

Date: Mon, 20 Apr 2020 19:35:02 UTC

Severity: important

Done: Dale Smith <dalepsmith <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #37 received at 40737 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Andrew Gierth <andrew <at> tao11.riddles.org.uk>
Cc: Andy Wingo <wingo <at> igalia.com>, dsmich <at> roadrunner.com, 40737 <at> debbugs.gnu.org
Subject: Re: bug#40737: Segfault in arm gcc7, thumb2 builroot, with arm patch
Date: Sat, 20 Jun 2020 16:04:28 +0200
Hi Andrew,

Andrew Gierth <andrew <at> tao11.riddles.org.uk> skribis:

> diff --git a/libguile/lightening/lightening/arm-cpu.c b/libguile/lightening/lightening/arm-cpu.c
> index 4445266af..2b4eecc29 100644
> --- a/libguile/lightening/lightening/arm-cpu.c
> +++ b/libguile/lightening/lightening/arm-cpu.c
> @@ -230,7 +230,7 @@ encode_thumb_immediate(unsigned int v)
>      return ((v & 0xff) | (1 << 12));
>    /* abcdefgh 00000000 abcdefgh 00000000 */
>    if (((v & 0xffff0000) >> 16) == (v & 0xffff) && (v & 0xff) == 0)
> -    return ((v & 0x000000ff) | (2 << 12));
> +    return (((v & 0x0000ff00) >> 8) | (2 << 12));
>    /* abcdefgh abcdefgh abcdefgh abcdefgh */
>    if ( (v &    0xff)        == ((v &     0xff00) >>  8) &&
>         ((v &   0xff00) >> 8) == ((v &   0xff0000) >> 16) &&

I pushed this fix to the lightening repo on your behalf:

  https://gitlab.com/wingo/lightening/-/commit/1bb909a44d2303f88bb05125fc6742e97f80cd1d

The CI jobs pass:

  https://gitlab.com/wingo/lightening/-/pipelines/158337465

I’ll try merging it into Guile, but do you have a test that reproduces
the original bug, either at the Guile level or in C using the lightening
API?  Perhaps the test that Dale posted yesterday at
<https://paste.debian.net/1152897/>?

--8<---------------cut here---------------start------------->8---
#include "test.h"                                               
                                                                
static void                                                     
run_test(jit_state_t *j, uint8_t *arena_base, size_t arena_size)
{                                                               
  jit_begin(j, arena_base, arena_size);                         
                                                                
  jit_movi(j, JIT_R0, 0xa500a500);                              
  jit_retr(j, JIT_R0);                                          
                                                                
  jit_uword_t (*f)(void) = jit_end(j, NULL);                    
                                                                
  ASSERT(f() == 0xa500a500);                                    
}                                                               
                                                                
int                                                             
main (int argc, char *argv[])                                   
{                                                               
  return main_helper(argc, argv, run_test);                     
}                                                               
--8<---------------cut here---------------end--------------->8---

Thanks,
Ludo’.




This bug report was last modified 4 years and 332 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.