core: Document number->string INT-MIN failure with gcc-x86.

* src/mes.c (scm_symbol_arch, scm_symbol_compiler): New symbol.
  (mes_symbols, bload_env): Add them.
  (scm_symbol_gnuc, scm_symbol_mesc): Remove.
* scaffold/mini-mes.c: Likewise.
* module/mes/mes-0.scm (%arch, %compiler): New public variable.
* tests/srfi-13.test: Expect number->string INT-MIN to fail for
  gcc-x86.
* HACKING (Bugs): Add it.
This commit is contained in:
Jan Nieuwenhuizen 2018-07-21 15:20:01 +02:00
parent 4f2c685753
commit 87269a16f6
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
5 changed files with 67 additions and 34 deletions

View file

@ -136,6 +136,10 @@ enough to work on compiling tinycc's tcc.c albeit a somewhat modified version.
* Bugs * Bugs
** mes: gcc-x86 compiled, tests/srfi-13.test number->string INT-MIN fails:
test: number->string INT-MIN: fail
expected: -2147483648
actual: -./,),(-*,(
** tcc: tcc-built lib/libc+tcc.c segfaults with mes, with tcc. ** tcc: tcc-built lib/libc+tcc.c segfaults with mes, with tcc.
** mes: remove pmatch-car/pmatch-cdr hack. ** mes: remove pmatch-car/pmatch-cdr hack.
** mescc: softcode stack frame size, now hardcoded and very large ** mescc: softcode stack frame size, now hardcoded and very large

View file

@ -35,6 +35,8 @@
guile? guile?
guile-1.8? guile-1.8?
guile-2? guile-2?
%arch
%compiler
)) ))
(define-macro (mes-use-module . rest) #t) (define-macro (mes-use-module . rest) #t)
@ -45,3 +47,5 @@
(define guile-2? (equal? (major-version) "2")) (define guile-2? (equal? (major-version) "2"))
(define EOF (if #f #f)) (define EOF (if #f #f))
(define append2 append) (define append2 append)
(define %arch (car (string-split %host-type #\-)))
(define %compiler "gcc")

View file

@ -195,8 +195,8 @@ struct scm scm_type_variable = {TSYMBOL, "<cell:variable>",0};
struct scm scm_type_vector = {TSYMBOL, "<cell:vector>",0}; struct scm scm_type_vector = {TSYMBOL, "<cell:vector>",0};
struct scm scm_type_broken_heart = {TSYMBOL, "<cell:broken-heart>",0}; struct scm scm_type_broken_heart = {TSYMBOL, "<cell:broken-heart>",0};
struct scm scm_symbol_gnuc = {TSYMBOL, "%gnuc",0}; struct scm scm_symbol_compiler = {TSYMBOL, "%compiler",0};
struct scm scm_symbol_mesc = {TSYMBOL, "%mesc",0}; struct scm scm_symbol_arch = {TSYMBOL, "%arch",0};
struct scm scm_test = {TSYMBOL, "test",0}; struct scm scm_test = {TSYMBOL, "test",0};
@ -838,13 +838,19 @@ mes_symbols () ///((internal))
a = acons (cell_symbol_call_with_current_continuation, cell_call_with_current_continuation, a); a = acons (cell_symbol_call_with_current_continuation, cell_call_with_current_continuation, a);
a = acons (cell_symbol_sc_expand, cell_f, a); a = acons (cell_symbol_sc_expand, cell_f, a);
#if __GNUC__ char *compiler = "gcc";
a = acons (cell_symbol_gnuc, cell_t, a); #if __MESC__
a = acons (cell_symbol_mesc, cell_f, a); compiler = "mescc";
#else #elif __TINYC__
a = acons (cell_symbol_gnuc, cell_f, a); compiler = "tcc";
a = acons (cell_symbol_mesc, cell_t, a);
#endif #endif
a = acons (cell_symbol_compiler, MAKE_STRING (cstring_to_list (compiler)), a);
char *arch = "x86";
#if __x86_64__
arch = "x86_64";
#endif
a = acons (cell_symbol_arch, MAKE_STRING (cstring_to_list (arch)), a);
a = acons (cell_closure, a, a); a = acons (cell_closure, a, a);
@ -918,13 +924,19 @@ bload_env (SCM a) ///((internal))
g_stdin = STDIN; g_stdin = STDIN;
r0 = mes_builtins (r0); r0 = mes_builtins (r0);
#if __GNUC__ char *compiler = "gcc";
set_env_x (cell_symbol_gnuc, cell_t, r0); #if __MESC__
set_env_x (cell_symbol_mesc, cell_f, r0); compiler = "mescc";
#else #elif __TINYC__
set_env_x (cell_symbol_gnuc, cell_f, r0); compiler = "tcc";
set_env_x (cell_symbol_mesc, cell_t, r0);
#endif #endif
set_env_x (cell_symbol_compiler, MAKE_STRING (cstring_to_list (compiler)), r0);
char *arch = "x86";
#if __x86_64__
arch = "x86_64";
#endif
set_env_x (cell_symbol_arch, MAKE_STRING (cstring_to_list (arch)), r0);
if (g_debug) if (g_debug)
{ {

View file

@ -235,10 +235,10 @@ struct scm scm_type_variable = {TSYMBOL, "<cell:variable>",0};
struct scm scm_type_vector = {TSYMBOL, "<cell:vector>",0}; struct scm scm_type_vector = {TSYMBOL, "<cell:vector>",0};
struct scm scm_type_broken_heart = {TSYMBOL, "<cell:broken-heart>",0}; struct scm scm_type_broken_heart = {TSYMBOL, "<cell:broken-heart>",0};
struct scm scm_symbol_gnuc = {TSYMBOL, "%gnuc",0}; struct scm scm_symbol_compiler = {TSYMBOL, "%compiler",0};
struct scm scm_symbol_mesc = {TSYMBOL, "%mesc",0}; struct scm scm_symbol_arch = {TSYMBOL, "%arch",0};
struct scm scm_test = {TSYMBOL, "test",0}; struct scm scm_test = {TSYMBOL, "%%test",0};
#if !_POSIX_SOURCE #if !_POSIX_SOURCE
#include "mes.mes.symbols.h" #include "mes.mes.symbols.h"
@ -1830,10 +1830,10 @@ g_free++;
g_cells[cell_vm_return] = scm_vm_return; g_cells[cell_vm_return] = scm_vm_return;
g_free++; g_free++;
g_cells[cell_symbol_gnuc] = scm_symbol_gnuc; g_cells[cell_symbol_compiler] = scm_symbol_compiler;
g_free++; g_free++;
g_cells[cell_symbol_mesc] = scm_symbol_mesc; g_cells[cell_symbol_arch] = scm_symbol_arch;
g_free++; g_free++;
g_cells[cell_test] = scm_test; g_cells[cell_test] = scm_test;
@ -1948,8 +1948,8 @@ g_cells[cell_vm_call_with_values2].car = g_cells[cell_vm_evlis].car;
g_cells[cell_vm_call_with_current_continuation2].car = g_cells[cell_vm_evlis].car; g_cells[cell_vm_call_with_current_continuation2].car = g_cells[cell_vm_evlis].car;
g_cells[cell_vm_return].car = g_cells[cell_vm_evlis].car; g_cells[cell_vm_return].car = g_cells[cell_vm_evlis].car;
g_cells[cell_symbol_gnuc].car = cstring_to_list (scm_symbol_gnuc.name); g_cells[cell_symbol_compiler].car = cstring_to_list (scm_symbol_compiler.name);
g_cells[cell_symbol_mesc].car = cstring_to_list (scm_symbol_mesc.name); g_cells[cell_symbol_arch].car = cstring_to_list (scm_symbol_arch.name);
g_cells[cell_test].car = cstring_to_list (scm_test.name); g_cells[cell_test].car = cstring_to_list (scm_test.name);
////////////////// gc ////////////////// gc
@ -1967,13 +1967,20 @@ g_cells[cell_test].car = cstring_to_list (scm_test.name);
a = acons (cell_symbol_mes_version, MAKE_STRING (cstring_to_list (VERSION)), a); a = acons (cell_symbol_mes_version, MAKE_STRING (cstring_to_list (VERSION)), a);
a = acons (cell_symbol_mes_prefix, MAKE_STRING (cstring_to_list (PREFIX)), a); a = acons (cell_symbol_mes_prefix, MAKE_STRING (cstring_to_list (PREFIX)), a);
#if __GNUC__ char *compiler = "gcc";
a = acons (cell_symbol_gnuc, cell_t, a); #if __MESC__
a = acons (cell_symbol_mesc, cell_f, a); compiler = "mescc";
#else #elif __TINYC__
a = acons (cell_symbol_gnuc, cell_f, a); compiler = "tcc";
#endif #endif
a = acons (cell_symbol_compiler, MAKE_STRING (cstring_to_list (compiler)), a);
char *arch = "x86";
#if __x86_64__
arch = "x86_64";
#endif
a = acons (cell_symbol_arch, MAKE_STRING (cstring_to_list (arch)), a);
#endif // !MES_MINI #endif // !MES_MINI
a = acons (cell_type_char, MAKE_NUMBER (TCHAR), a); a = acons (cell_type_char, MAKE_NUMBER (TCHAR), a);
@ -2329,13 +2336,19 @@ bload_env (SCM a) ///((internal))
g_stdin = STDIN; g_stdin = STDIN;
r0 = mes_builtins (r0); r0 = mes_builtins (r0);
#if __GNUC__ char *compiler = "gcc";
set_env_x (cell_symbol_gnuc, cell_t, r0); #if __MESC__
set_env_x (cell_symbol_mesc, cell_f, r0); compiler = "mescc";
#else #elif __TINYC__
set_env_x (cell_symbol_gnuc, cell_f, r0); compiler = "tcc";
set_env_x (cell_symbol_mesc, cell_t, r0);
#endif #endif
a = acons (cell_symbol_compiler, MAKE_STRING (cstring_to_list (compiler)), a);
char *arch = "x86";
#if __x86_64__
arch = "x86_64";
#endif
a = acons (cell_symbol_arch, MAKE_STRING (cstring_to_list (arch)), a);
if (g_debug > 3) if (g_debug > 3)
{ {

View file

@ -108,4 +108,4 @@ exec ${MES-src/mes} --no-auto-compile -L ${0%/*} -L module -C module -e '(tests
(pass-if-equal "string-replace" "fubar" (pass-if-equal "string-replace" "fubar"
(string-replace "foobar" "u" 1 3)) (string-replace "foobar" "u" 1 3))
(result 'report) (result 'report (if (and (equal? %compiler "gcc") (equal? %arch "x86")) 1 0))