[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Test case for C99 feature

From: Pedro A ARANDA
Subject: [Tinycc-devel] Test case for C99 feature
Date: Mon, 21 Mar 2011 13:27:13 +0000


I have been testing the latest mob and have found a strange behaviour when
playing with c99 flexible array members:

Source code:

#include <stdio.h>

typedef struct _pascal_string {
    int len;
    char string[];
} pascal_string;

int main(int argc,char **argv) {
    printf("sizeof(pascal_string) = %d\n",sizeof(pascal_string));
    printf("!!! sizeof(pascal_string) = %d\n",pascal_string);

Compiling with GCC:

address@hidden:~.../Devel$ gcc kk.c
kk.c: In function ‘main’:
kk.c:10: error: expected _expression_ before ‘pascal_string’

JIT compoling with TCC sucessfull, but executing results in segment violation in
offending line

address@hidden:~.../Devel$ tcc -run kk.c
sizeof(pascal_string) = 4
Violación de segmento


reply via email to

[Prev in Thread] Current Thread [Next in Thread]