tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] TCC crash with incorrect syntax in compound literal


From: Pascal Cuoq
Subject: Re: [Tinycc-devel] TCC crash with incorrect syntax in compound literal
Date: Sun, 17 Mar 2019 15:03:59 +0000

Hello again,

On 17 Mar 2019, at 13:56, Pascal Cuoq <address@hidden> wrote:

2) I noticed that a variant of the input I initially reported in this thread is still crashing TCC.

The variant that still crashes TCC as of commit d72b877 is:

void f(char *);

void g(void) {
  f((char[]){1, ,});
}

It is very similar to the previous input but this time there is a first element before the syntactically incorrect “, ,” in the compound literal.

The attached patch makes the program above rejected without crash, does not seem to break “make test” (I think I know what it looks like when the tests are broken because my first fix did break them), and it makes the following program accepted too (and compiled to a binary that behaves as intended):

#include <stdio.h>

int main(void) {
  printf("%zu %s\n", sizeof (char[]){'a', 0,}, (char[]){'a', 0,});
}

It might be close to the right fix.

Pascal

Attachment: comma_comma.patch
Description: comma_comma.patch


reply via email to

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