[Tinycc-devel] Incorrect shift result type with 64-bit ABI

2012-06-26 Thread Vincent Lefevre
Hi, The behavior on the following program is incorrect with Debian's tcc (at least up to 0.9.26~git20120612.ad5f375-3) on x86_64 (64-bit ABI). #include #define M1 (1 << (int) 1) #define M2 (1 << (unsigned int) 1) #define M3 (1 << (long) 1) #define M4 (1 << (unsigned long) 1) #define M5 (1 << (l

Re: [Tinycc-devel] Incorrect shift result type with 64-bit ABI

2012-06-27 Thread Vincent Lefevre
On 2012-06-26 15:07:57 +0200, Vincent Lefevre wrote: > ISO C99 TC3 says: [6.5.7#3] "The integer promotions are performed on > each of the operands. The type of the result is that of the promoted > left operand." I've written a patch (attached). Now the shift problems no longer occur with the testc

Re: [Tinycc-devel] Incorrect shift result type with 64-bit ABI

2012-06-27 Thread Milutin Jovanović
The patch looks good to me. I also did some basic tests, and the patch did not seem to break anything. I assumed you wanted it commited, so I did that in your name. Miki. On 27 June 2012 07:31, Vincent Lefevre wrote: > On 2012-06-26 15:07:57 +0200, Vincent Lefevre wrote: > > ISO C99 TC3 says:

Re: [Tinycc-devel] Incorrect shift result type with 64-bit ABI

2012-06-27 Thread Thomas Preud'homme
Le mercredi 27 juin 2012 14:34:25, Milutin Jovanović a écrit : > The patch looks good to me. I also did some basic tests, and the patch did > not seem to break anything. I assumed you wanted it commited, so I did that > in your name. You overtook me ;) It looks good to me and I was upgrading my i3

Re: [Tinycc-devel] Incorrect shift result type with 64-bit ABI

2012-06-27 Thread Vincent Lefevre
On 2012-06-27 14:38:44 +0200, Thomas Preud'homme wrote: > Le mercredi 27 juin 2012 14:34:25, Milutin Jovanović a écrit : > > The patch looks good to me. I also did some basic tests, and the patch did > > not seem to break anything. I assumed you wanted it commited, so I did that > > in your name. >

Re: [Tinycc-devel] Incorrect shift result type with 64-bit ABI

2012-06-27 Thread Milutin Jovanović
Vincent, Would you mind adding your test into the test "suite". Pick tests or tests2 which ever you find easier to add to. I hope it will take only minutes since you already have them written. Miki. On 27 June 2012 12:57, Vincent Lefevre wrote: > On 2012-06-27 14:38:44 +0200, Thomas Preud'ho

Re: [Tinycc-devel] Incorrect shift result type with 64-bit ABI

2012-07-06 Thread Vincent Lefevre
Hi, On 2012-06-27 15:02:20 -0400, Milutin Jovanović wrote: > Would you mind adding your test into the test "suite". Pick tests or tests2 > which ever you find easier to add to. I hope it will take only minutes > since you already have them written. I've rewritten my tests to be added to the test

Re: [Tinycc-devel] Incorrect shift result type with 64-bit ABI

2012-07-06 Thread Vincent Lefevre
On 2012-07-06 13:33:23 +0200, Vincent Lefevre wrote: > I've rewritten my tests to be added to the test suite and improved > them. They show that my patch was actually incorrect when the > first argument is unsigned short: the type should by int, not > unsigned int. This needs to be fixed... Fixed

Re: [Tinycc-devel] Incorrect shift result type with 64-bit ABI

2012-07-06 Thread Thomas Preud'homme
Le vendredi 6 juillet 2012 14:25:54, Vincent Lefevre a écrit : > On 2012-07-06 13:33:23 +0200, Vincent Lefevre wrote: > > I've rewritten my tests to be added to the test suite and improved > > them. They show that my patch was actually incorrect when the > > first argument is unsigned short: the ty