Re: [Tinycc-devel] Segfault on arm64 when making a function call with many arguments

2021-06-19 Thread Christian Jullien
Without the patch, it also coredumps on Risc-V: jullien@gcc401:~$ tcc -v tcc version 0.9.27 - 0378168 (riscv64 Linux) jullien@gcc401:~$ tcc -o foo foo.c && ./foo Illegal instruction (core dumped) -Original Message- From: Tinycc-devel

Re: [Tinycc-devel] Segfault on arm64 when making a function call with many arguments

2021-06-19 Thread Christian Jullien
Hi, I only tested the latest patch supplied by Pursuer, When A == 0, it gives the expected result: tcc foo.c -o foo && ./foo 10 20 30 40 50 60 70 80 0 (no core dump) -Original Message- From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of grischka

Re: [Tinycc-devel] Integer constant expression bug

2021-06-19 Thread grischka
Elijah Stone wrote: Actually, the problem is with the CEXPR_EH macro; it always returns 1. If I replace the definition with '#define CEXPR_EH __builtin_constant_p', all of your tests pass. I guess the problem is that the behaviour of this clause (from 6.5.15p6) is not correctly implemented:

Re: [Tinycc-devel] Segfault on arm64 when making a function call with many arguments

2021-06-19 Thread grischka
Christian Jullien wrote: All parameters go to the right arguments. So patch looks good What happens if the first condition is false (A = 0) ? -- gr void main() { int A = 1; int B = 2; map_add(10, 20, 30, 40, 50, 60, 70, 80, A && B); } $ tcc foo.c -o foo && ./foo;echo

[Tinycc-devel] Linking OpenMP

2021-06-19 Thread imadr codes
I included "tcc\include\winapi\omp.h" and used the -fopenmp flag but got undefined references, is there anyway to link OpenMP with tcc? ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Re: [Tinycc-devel] Integer constant expression bug

2021-06-19 Thread Elijah Stone
Actually, the problem is with the CEXPR_EH macro; it always returns 1. If I replace the definition with '#define CEXPR_EH __builtin_constant_p', all of your tests pass. I guess the problem is that the behaviour of this clause (from 6.5.15p6) is not correctly implemented: if one operand is

Re: [Tinycc-devel] Segfault on arm64 when making a function call with many arguments

2021-06-19 Thread Pursuer via Tinycc-devel
Thank you. (I just used another email account and forgot to add nickname in previous email.) After inspecting the code more deeply, I found another way to fix this bug. Most functions in tccgen.c ,which modify the vstack , callvcheck_cmp() at the beginning (like "vsetc" ,"vswap", "vrotb"

Re: [Tinycc-devel] Segfault on arm64 when making a function call with many arguments

2021-06-19 Thread Christian Jullien
All parameters go to the right arguments. So patch looks good #include void map_add(int x0, int x1, int x2, int x3, int x4, int x5, int x6, int x7, in\ t x8) { printf("%d ", x0); printf("%d ", x1); printf("%d ", x2); printf("%d ", x3);

Re: [Tinycc-devel] Segfault on arm64 when making a function call with many arguments

2021-06-19 Thread Christian Jullien
Hi just quickly tested on my RPi arm64. I don't know if it works, i.e. all arguments go to the right parameter with the right value but, at least it no longer segfault. I'll make more tests today. C. From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On

Re: [Tinycc-devel] Segfault on arm64 when making a function call with many arguments

2021-06-19 Thread pursuer2 via Tinycc-devel
This bug may caused by "vpushv" SValue with VT_CMP flag. There should be only one VT_CMP SValue on vstack. I make below patch to fix it, then thecompilationexit normally. But I have no arm64 device with GNU/Linux to verify the test. diff --git a/arm64-gen.c b/arm64-gen.c index 6389409..a9cbfa2