[Tinycc-devel] C99 token pasting

2014-04-01 Thread Jay Foad
C99 specifies the behaviour of token pasting when either (or both) of
the arguments to be pasted expand to an empty sequence of tokens. tcc
doesn't seem to implement this:

$ cat p.c
#define P(A,B) A ## B bob
#define Q(A,B) A ## B+
P(jim,)
Q(+,)
$ ./tcc -E p.c
# 2 p.c
p.c:3: warning: pasting jim and   does not give a valid preprocessing token

jim bob
++

In the P() example, the warning is inappropriate.
In the Q() example, the result is wrong. We should get + and + as two
separate tokens, not the single token ++.

Jay.

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


Re: [Tinycc-devel] Valgrind Inconsistency detected by ld.so: rtld.c:

2014-04-01 Thread Domingo Alvarez Duarte
Hello Daniel !

Just in case do you want to look at it too, I discovered other issue with
sqlite3 compiled with tcc on arm,
running the query bellow on sqlite3-gcc takes 1 second but doing the same
on sqlite3-tcc takes for ever,
if we remove the call to datetime and use only the field mtime the the
sqlite3-tcc works almost like sqlite3-gcc.

Obs.: fossil.fossil is the database of fossil-scm local repository.

sqlite3-gcc fossil.fossil  query.sql
sqlite3-tcc fossil.fossil  query.sql


-
--EXPLAIN
SELECT
  datetime(event.mtime) AS timestamp
  --mtime
 FROM event
ORDER BY 1 --event.mtime
DESC
LIMIT 20;
-


On Mon, Mar 31, 2014 at 11:14 PM, Domingo Alvarez Duarte mingo...@gmail.com
 wrote:

 Hello Daniel !

 I'm still looking at why fossil-scm compiled by tcc do not work properly
 and found that now the problem is with the sqlite3 sources compiled with
 tcc, in a place where we have a fossil repository database I run this:

 -
 #include stdio.h
 #include stdarg.h
 #include src/sqlite3.h

 static int mydb_exists(sqlite3 *db, const char *zSql, ...){
   va_list ap;
   int rc;
   va_start(ap, zSql);
   sqlite3_stmt *pStmt;
   rc = sqlite3_prepare_v2(db, zSql, -1, pStmt, 0);
   va_end(ap);
 printf(%s:%d - %d %s\n, __FILE__, __LINE__, rc, zSql);
   rc = sqlite3_step(pStmt);
 printf(%s:%d - %d %s\n, __FILE__, __LINE__, rc, zSql);
   if( rc !=SQLITE_ROW ) {
 rc = 0;
   }else{
 rc = 1;
   }
   sqlite3_finalize(pStmt);
   return rc;
 }

 static const char *sql = SELECT 
   blob.rid AS blobRid, 
   uuid AS uuid, 
   datetime(event.mtime) AS timestamp, 
   coalesce(ecomment, comment) AS comment, 
   coalesce(euser, user) AS user, 
   blob.rid IN leaf AS leaf, 
   bgcolor AS bgColor, 
   event.type AS eventType, 
   (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref 
 WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid 
   AND tagxref.rid=blob.rid AND tagxref.tagtype0) AS tags, 
   tagid AS tagid, 
   brief AS brief, 
   event.mtime AS mtime 
  FROM event CROSS JOIN blob 
 WHERE blob.rid=event.objid 
  AND NOT EXISTS(SELECT 1 FROM tagxref WHERE tagid=5 AND tagtype0 AND
 rid=blob.rid) ORDER BY event.mtime DESC LIMIT 20;


 int main() {

 sqlite3 *db;
 int rc = sqlite3_open_v2(
fossil.fossil, db,
SQLITE_OPEN_READWRITE, NULL);
 printf(%d Exists %d\n, rc, mydb_exists(db, sql));
  sqlite3_close(db);
 return 0;
 }
 -

 compiling it with this script:

 -
 gcc -o test-query-gcc test-query.c src/sqlite3.c -ldl -lpthread
 tcc -o test-query-tcc test-query.c src/sqlite3.c -ldl -lpthread
 -

 And get results from the test-query-gcc but no results from
  test-query-tcc, now I'll try to get more close to the problem.

 Cheers !


 On Sat, Mar 29, 2014 at 5:57 PM, Domingo Alvarez Duarte 
 mingo...@gmail.com wrote:

 Hello Daniel !

 With your commit tcc can compile and run the server but it's not all
 functional, like the timeline shows nothing.

 I'll further invetigate why and send you more details about what can be
 now.

 Thanks so much !


 On Sat, Mar 29, 2014 at 5:20 PM, Daniel Glöckner daniel...@gmx.netwrote:

 On Fri, Mar 28, 2014 at 12:27:39PM +, Domingo Alvarez Duarte wrote:
  For arm experts, it gets a segfault on translate.c:98

 Please try again with current mob.
 I fixed a bug that might be the cause for your segfault.

 Best regards,

   Daniel


 P.S.: I wonder if a better fix would be to use convert_parameter_type in
   gfunc_param_typed.

 ___
 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


[Tinycc-devel] Fwd: Bug#675024: tcc: errors Symbol `mpfr_xxx' causes overflow in R_X86_64_PC32 relocation

2014-04-01 Thread Thomas Preudhomme
Another report about the current state of shared libraries produced by 
tcc. Michael, I'm just copying it here because you asked. It's ok if you 
don't want or can't work on this.


Best regards,

Thomas

 Message original 
Objet: Bug#675024: tcc: errors Symbol `mpfr_xxx' causes overflow in 
R_X86_64_PC32 relocation

Date: 2014-04-01 07:15
De: Vincent Lefevre vinc...@vinc17.net
À: Thomas Preud'homme robo...@debian.org
Cc: 675...@bugs.debian.org
Répondre à: Vincent Lefevre vinc...@vinc17.net, 
675...@bugs.debian.org


Control: tags -1 - fixed-upstream

On 2014-03-31 22:22:03 +0800, Thomas Preud'homme wrote:

Two commits were done upstream to fix this bug. The author (Michael
Matz) would appreciate some testing to see if it works correctly.


With MPFR 3.1.2 configured with ./configure CC=tcc, I still get
Symbol `...' causes overflow in R_X86_64_PC32 relocation messages,
but the tests no longer fail... except texceptions.

Actually the symbols are no longer mpfr_xxx, but libc functions, e.g.

ypig:.../mpfr-3.1.2/tests ./texceptions
./texceptions: Symbol `abort' causes overflow in R_X86_64_PC32 
relocation

zsh: segmentation fault (core dumped)  ./texceptions

I'm not sure whether this is related, but it seems so, because
if I configure MPFR with ./configure --disable-shared CC=tcc,
all tests pass.

I could reduce texceptions.c to:

#include mpfr-test.h

int
main (void)
{
  (mpfr_clear_flags)();
  return 0;
}

Then I get:

ypig:.../mpfr-3.1.2/tests ./texceptions
zsh: segmentation fault (core dumped)  ./texceptions

The message has disappeared, but it still crashes.

--
Vincent Lefèvre vinc...@vinc17.net - Web: https://www.vinc17.net/
100% accessible validated (X)HTML - Blog: 
https://www.vinc17.net/blog/

Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



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


Re: [Tinycc-devel] improving get_tok_str

2014-04-01 Thread Thomas Preudhomme

Le 2014-03-31 23:46, mobi phil a écrit :


Was not proposing to commit this into the main repo, just a very
simple way to tag lines that probably need some more comments.
The experts then just could do a diff and see those points, remove
the tag and/or add comment.


Oh you mean through another repo? Sorry, I assumed the main repo. I'm 
too used to the centralized approach we have for tcc.




Thought this would be a very simple channel for this goal.


Yeah indeed. But it would make searching the questions not so easy. 
You'd use diff but over time the diff would also contain the answers.




Do you have any specific code review platform, that could be well
integrated with git and a simple editor like vim?


Nope sorry. I know you can do this via github but I'd rather we stick 
to open platform if possible. But yeah, github would be easy to setup.




Honestly never used mob. On http://repo.or.cz/h/mob.html [1], _only_
if you add a mob user and statement made me thinking that I need
some access grant. Will read again the documentation.


It mentions about the administrator of the repo. As a user you have 
almost nothing to do. Mob is enabled for tcc so you can just push as I 
said.


Best regards,

Thomas

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


Re: [Tinycc-devel] Valgrind Inconsistency detected by ld.so: rtld.c:

2014-04-01 Thread Thomas Preudhomme

Le 2014-04-01 19:53, Domingo Alvarez Duarte a écrit :

Hello Daniel !


Hi Domingo,



Just in case do you want to look at it too, I discovered other issue
with sqlite3 compiled with tcc on arm,
running the query bellow on sqlite3-gcc takes 1 second but doing the
same on sqlite3-tcc takes for ever,
if we remove the call to datetime and use only the field mtime the 
the

sqlite3-tcc works almost like sqlite3-gcc.


I think there would be more chance that someone work on it if you can 
provide a simple testcase or at least a complete testcase. Typically 
something that fit in only one source file. I acknowledge that it is not 
always possible or easy to find such a testcase but tinycc like most 
(all?) free software lack of manpower and something difficult to 
reproduce is very likely not going to be taken care of.


Best regards,

Thomas

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