[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] tcc fails to compile the J interpreter
From: |
Sergey Korshunoff |
Subject: |
Re: [Tinycc-devel] tcc fails to compile the J interpreter |
Date: |
Sat, 24 Jan 2015 09:51:43 +0300 |
> was able to reduce the test case to the code below. Maybe it's
> possible to resolve the compiler bug with this.
> struct{int c[1];} cases[] = {((int)0)};
A problem is with the initialization of the array inside struct:
A rigth form:
struct{int c[1];} cases[] = { {((int)0)} };
^ ^
An accepted form:
struct{int c[1];} cases[] = { (int)0 };
A code which handles this is inside tccgen.c (search "par_count").
This code assume that ')' must end before an initializer value. There
is a comment:
/* XXX: this test is incorrect for local initializers
beginning with ( without {. It would be much more difficult
to do it correctly (ideally, the expression parser should
be used in all cases) */
=> tcc can not handle such case and It would be much more difficult to
do it correctly
Is it possible to correct a open j code to place the array
initializers inside "{}" ?