[Tinycc-devel] Array BUG

2010-03-15 Thread Alexei
#include stdio.h
int arr[2];
typedef intList[];
typedef List*  pList; 
pList pa;
int main(int argc, char **argv)
{
  printf([0]=%X [1]=%X\n,arr[0],arr[1]);
  pa = arr;
  printf([0]=%X [1]=%X\n,pa[0],pa[1]);
}
Runtime:
[0]=4020D0 [1]=4020D4
[0]=4020D0 [1]=4020CC



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


Re: [Tinycc-devel] Array BUG

2010-03-15 Thread pancake
this code doesnt compiles with gcc ,the bug is because tcc allows to 
compile such expressions?


can you explain it better?

a.c: In function ‘main’:
a.c:8: warning: format ‘%X’ expects type ‘unsigned int’, but argument 2 
has type ‘int *’
a.c:8: warning: format ‘%X’ expects type ‘unsigned int’, but argument 3 
has type ‘int *’

a.c:10: error: invalid use of array with unspecified bounds
a.c:10: error: invalid use of array with unspecified bounds
a.c:10: warning: format ‘%X’ expects type ‘unsigned int’, but argument 2 
has type ‘pList’
a.c:10: warning: format ‘%X’ expects type ‘unsigned int’, but argument 3 
has type ‘pList’


Alexei wrote:

#include stdio.h
int arr[2];
typedef intList[];
typedef List*  pList; 
pList pa;

int main(int argc, char **argv)
{
  printf([0]=%X [1]=%X\n,arr[0],arr[1]);
  pa = arr;
  printf([0]=%X [1]=%X\n,pa[0],pa[1]);
}
Runtime:
[0]=4020D0 [1]=4020D4
[0]=4020D0 [1]=4020CC



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

  




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


Re: [Tinycc-devel] Array BUG

2010-03-15 Thread Daniel Glöckner
On Mon, Mar 15, 2010 at 11:30:51AM +0100, pancake wrote:
 this code doesnt compiles with gcc ,the bug is because tcc allows to
 compile such expressions?

 a.c:10: error: invalid use of array with unspecified bounds
 a.c:10: error: invalid use of array with unspecified bounds

I have a patch that detects this error. Will push it to mob after work.

  Daniel


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