[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] [RFC] tinycc and rock compiler
From: |
Christian Jullien |
Subject: |
Re: [Tinycc-devel] [RFC] tinycc and rock compiler |
Date: |
Sun, 30 Aug 2015 08:22:52 +0200 |
This is not a BUG but a feature that C compliers often propose (for example,
VC++ has: /GF enable read-only string pooling)
Strictly speaking, tcc is right with this behavior and no portable programs
should rely on this feature.
If you want a faster code when this feature exists you should write:
if ((p1 == p2) || strcmp(p1,p2) == 0 )
printf("OK\n");
else
printf("There is a problem\n");
}
IMHO having this feature with tcc should be with a new option.
C.
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Sergey Korshunoff
Sent: dimanche 30 août 2015 03:54
To: address@hidden
Subject: [Tinycc-devel] [RFC] tinycc and rock compiler
Hi all!
I think there is a problem wiith using tcc for compiling a rock parser
sources. Some snippet (NagaQueen.c):
if (!yymatchClass(G, (const unsigned char
*)"\000\000\000\000\000\000\377\003\376\377\377\207\376\377\377\007\000\000\
000\000\000\000\000\000\000\000\000\000\000\000\000\000",
"a-zA-Z0-9_")) goto l920;
l921:;
{ int yypos922= G->pos, yythunkpos922= G->thunkpos; if (!yymatchClass(G,
(const unsigned char
*)"\000\000\000\000\000\000\377\003\376\377\377\207\376\377\377\007\000\000\
000\000\000\000\000\000\000\000\000\000\000\000\000\000",
"a-zA-Z0-9_")) goto l922;
And a test program:
#include <stdio.h>
int main()
{
const char *const p1 = "1234567890qwertyuiopasdfghjklzxcvbnm";
const char *const p2 = "1234567890qwertyuiopasdfghjklzxcvbnm";
if (p1 == p2 )
printf("OK\n");
else
printf("There is a problem\n");
}
A gcc output: OK
A tcc output: There is a problem
A proposal: introduce a string constant cache in a function scope level
(like this is done for the identifers). Would this help for a general
purpose programs? How often this programming style is used?
PS: this is only a size of the produced exe problem
_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel