tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] -b problem...


From: pierre
Subject: [Tinycc-devel] -b problem...
Date: Tue, 12 Dec 2017 16:40:10 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

Hi,


I have an error when running with bound check enabled a very simple file:

/***************************************************************/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

char *func(char *str) {
  int len;
  char *res;

  len = strlen(str);
  res = malloc(len + 3 + 1); //
  sprintf(res, "%s %d", str, 24);
 return res;
}

int main(int argc, char **argv)
{
  char *str;
  int a[10];

  str = func("test str");
  printf(str);

  a[0] = 10;
  printf("end");

  return 0;

}

/***************************************************************/


If I launch

  • tcc -I libtcc libtcc/libtcc.def -run test.c

I am getting:

  • test str 24end

but if I launch:

  • tcc -I libtcc libtcc/libtcc.def -b -g -run test.c

I am getting:

  • test str 24Runtime error: access violation
    test.c:23: at 0000000000356111 main()


any idea of why?

thanks,

Pierre

reply via email to

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