Re: [Tinycc-devel] State of the tcc project (jiang)

2014-06-21 Thread grischka

jiang wrote:

 /* bitfield store handling */
+SValue tmp;
+tmp = vtop[0];
[...]
+vtop--;
+vpushv(&tmp);



This is still not a solution.  See

#include 
int main(int argc, char **argv)
{
struct {
unsigned a:9, b:5, c:7;
} _s, *s = &_s;
int n = 250;

s->a = s->b = s->c = n + 4;
printf("--> %d / %d / %d\n", s->a, s->b, s->c);
return 0;
}
--> 432 / 16 / 126

gcc & msvc:
--> 30 / 30 / 126
tcc release_0_9_26
--> 254 / 30 / 126

FWIW, the line above is the reason why I'm trying to investigate
this.  Let's see if Mr. jiang can come up with something useful
(and how long it will take).

-- gr

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] State of the tcc project (jiang)

2014-06-20 Thread lifenjoiner
Hi,


> On Behalf Of jiang

> index 22a8278..2fd4614 100644
> @@ -1655,6 +1655,15 @@ void bitfield_test(void)
>   else
>   printf("st1.f2 != -1\n");
> 
> +/* XXX: gcc bug

My logic is:
If it is a bug, why we should follow a wrong way?

Aidan Dodds wrote: It looks like you are trying to reproduce a gcc bug, ---
I agree.

> +st1.f1 = st1.f2 = st1.f3 = st1.f4 = st1.f5 = 3;
> +printf("%d %d %d %d %d\n",
> +   st1.f1, st1.f2, st1.f3, st1.f4, st1.f5);
> +*/
> +st1.f2 = st1.f3 = st1.f4 = st1.f5 = 3;
> +printf("%d %d %d %d %d\n",
> +   st1.f2, st1.f3, st1.f4, st1.f5);
> +
>   /* bit sizes below must be bigger than 32 since GCC doesn't allow
>  long-long bitfields whose size is not bigger than int */
>   struct sbf2 {
> 




___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] State of the tcc project (jiang)

2014-06-20 Thread Aidan Dodds

I see now that must be intentional, but that's also very dangerous.

It looks like you are trying to reproduce a gcc bug, why not make that 
optional?  Perhaps proposing a compatibility mode if it would be a useful

thing to have.

Even if its sensible, you should really control what garbage data you 
are throwing out from that format specifier.  Why not generate a random

value to Emmit?  That would seem safer for a large number of reasons.

I should point out I don't know what problem you are trying to solve, 
this just strikes me as very dodgy code, especially when it seems you are
purposefully break working code, to implement a bug.  That surely 
effects everyone using tcc.



On 20/06/2014 11:08, Aidan Dodds wrote:


On 20/06/2014 06:58, jiang wrote:

printf("%d %d %d %d %d\n",
+   st1.f2, st1.f3, st1.f4, st1.f5); 


Am i being stupid, or do you specify 5 format specifiers with only 4 
arguments?!


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel



___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] State of the tcc project (jiang)

2014-06-20 Thread Aidan Dodds


On 20/06/2014 06:58, jiang wrote:

printf("%d %d %d %d %d\n",
+   st1.f2, st1.f3, st1.f4, st1.f5); 


Am i being stupid, or do you specify 5 format specifiers with only 4 
arguments?!


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel