tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Bug: "mov -0x10(%rbp), %eax", but source is 8-bit signed


From: Steffen Nurpmeso
Subject: [Tinycc-devel] Bug: "mov -0x10(%rbp), %eax", but source is 8-bit signed type
Date: Fri, 22 Jun 2018 17:59:04 +0200
User-agent: s-nail v14.9.10-133-g89e8d2ed

Hello again!

It is a bit mysterious, since i am using this executable for more
than three months, and i make heavy use of such things, for example

  address@hidden nail.git]$ git grep bool_t|wc -l
  968

I have rechecked [mob], same result.  The code is

  static int
  a_message_scan(char const **sp, bool_t use_shexp)
  {
     struct str shin_orig, shin;
     struct n_string shou, *shoup;
     struct a_message_lex const *lp;
     char *cp2;
     char const *cp;
     int rv, c, inquote, quotec;
     NYD_ENTER;

     rv = a_MESSAGE_T_EOL;

  fprintf(stderr, "USHEXL %d\n",use_shexp);
  use_shexp=FAL0;
  fprintf(stderr, "USHEXL %d\n",use_shexp);
     if(use_shexp){
  fprintf(stderr, "USHEXL %d\n",use_shexp);
  assert(0&&use_shexp);

and the assembly is

      27a0:       e8 00 00 00 00          callq  27a5 <a_message_scan+0x74>
  use_shexp=FAL0;
      27a5:       b8 00 00 00 00          mov    $0x0,%eax
      27aa:       88 45 f0                mov    %al,-0x10(%rbp)

This is right: use_shexp is bool_t and that is
  typedef signed char     si8_t;
  typedef si8_t           bool_t;

  fprintf(stderr, "USHEXL %d\n",use_shexp);
      27ad:       8b 45 f0                mov    -0x10(%rbp),%eax
      27b0:       49 89 c2                mov    %rax,%r10
      27b3:       48 8d 05 00 00 00 00    lea    0x0(%rip),%rax        # 27ba 
<a_message_scan+0x89>
      27ba:       48 89 c6                mov    %rax,%rsi
      27bd:       48 8b 05 00 00 00 00    mov    0x0(%rip),%rax        # 27c4 
<a_message_scan+0x93>
      27c4:       48 8b 00                mov    (%rax),%rax
      27c7:       48 89 c7                mov    %rax,%rdi
      27ca:       4c 89 d2                mov    %r10,%rdx
      27cd:       b8 00 00 00 00          mov    $0x0,%eax
      27d2:       e8 00 00 00 00          callq  27d7 <a_message_scan+0xa6>
     if(use_shexp){
      27d7:       8b 45 f0                mov    -0x10(%rbp),%eax

That should be movsbl i think.

      27da:       83 f8 00                cmp    $0x0,%eax
      27dd:       0f 84 60 00 00 00       je     2843 <a_message_scan+0x112>
  fprintf(stderr, "USHEXL %d\n",use_shexp);

(This is still on AlpineLinux and musl, and i use my own two
patches because the now available package fails for my use case
because of va_list, for example like this:

  *** tests results
  make[1]: Entering directory '/home/steffen/src/nail.git'
  /usr/bin/tcc -I./ -I/home/steffen/src/nail.git/ 
-I/home/steffen/src/nail.git/.obj 
-I/home/steffen/usr-essex-alpine-linux-x86_64/include 
-I/home/steffen/usr-essex-alpine-linux-x86_64/opt/idnkit-2/include 
-I/usr/local/include -I/usr/include                                   -W -Wall 
-Wextra -pedantic -g   -Wl,--enable-new-dtags 
-Wl,-rpath=/home/steffen/usr-essex-alpine-linux-x86_64/lib 
-Wl,-rpath=/home/steffen/usr-essex-alpine-linux-x86_64/opt/idnkit-2/lib 
-Wl,-rpath=/usr/local/lib   -o .obj/___tmp11706 .obj/___tmp11706.c 
-L/home/steffen/usr-essex-alpine-linux-x86_64/lib 
-L/home/steffen/usr-essex-alpine-linux-x86_64/opt/idnkit-2/lib -L/usr/local/lib 
                                 -lssl -lcrypto
  In file included from .obj/___tmp11706.c:2:
  In file included from /usr/include/openssl/ssl.h:149:
  In file included from /usr/include/openssl/hmac.h:67:
  In file included from /usr/include/openssl/evp.h:67:
  /usr/include/openssl/bio.h:736: error: invalid type
  make[1]: *** [.obj/___tmp.mk:7: .obj/___tmp11706] Error 1
  make[1]: Leaving directory '/home/steffen/src/nail.git'
  *** no

And i need to include the "standard paths" /usr/x and
/usr/local/x, because of course i want to honour the very order
the user specifies.)

Ciao.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]