|
From: | jiang |
Subject: | [Tinycc-devel] tcc grammar problems |
Date: | Sun, 13 Jul 2014 22:12:39 +0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
Hello everyone! (s->a = (s->b = (s->c = n + 4))); gcc & msvc: --> 30 / 30 / 126 // Because the return value is left tcc --> 254 / 30 / 126 // Because the return is the right value Shall tcc assignment modify what? Same with gcc&msvc. 于 2014年06月22日 01:49, jiang 写道:
This is my patch (see Annex) tcc result is correct --> 254 / 30 / 126 1 1 1 1 1 1 1 0 -> 254 254 & 0x7f (c:7) 1 1 1 1 1 1 1 0 -> 254 0 1 1 1 1 1 1 1 -> 0x7f ---------------------&----- 0 1 1 1 1 1 1 0 -> 126 (b:5) 0 1 1 1 1 1 1 0 -> 126 0 0 0 1 1 1 1 1 -> 0x1f ---------------------&----- 0 0 0 1 1 1 1 0 -> 30 (a:9) 0 0 0 0 1 1 1 1 0 -> 30 1 1 1 1 1 1 1 1 1 -> 0x1ff ---------------------&----- 0 0 0 1 1 1 1 0 -> 30 I guess gcc & mvc repeated use of the register, so wrong 于 2014年06月21日 22:25, address@hidden 写道:jiang wrote:/* bitfield store handling */ + SValue tmp; + tmp = vtop[0]; [...] + vtop--; + vpushv(&tmp);This is still not a solution. See #include <stdio.h> 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
[Prev in Thread] | Current Thread | [Next in Thread] |