[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] report a bug
From: |
Henry Kroll |
Subject: |
Re: [Tinycc-devel] report a bug |
Date: |
Mon, 18 Mar 2024 12:32:32 -0800 |
User-agent: |
Evolution 3.50.4 (3.50.4-1.fc39) |
On Mon, 2024-03-18 at 20:36 +0800, 837806295 via Tinycc-devel wrote:
>
>
> hello, report a bug, my English is not good, hope you understand.
>
> bug info
> file: tccpp.c
> function: parse_escape_string
> line: 2010
> ------------------------------------------------------
>
> do {
> c = *p;
> if (c >= 'a' && c <= 'f')
> c = c - 'a' + 10;
> else if (c >= 'A' && c <= 'F')
> c = c - 'A' + 10;
> else if (isnum(c))
> c = c - '0';
> ----> else if (i > 0)
> expect("more hex digits in universal-
> character-name");
> else
> goto add_hex_or_ucn;
> n = n * 16 + c;
> p++;
> } while (--i);
>
> it should be
>
> else if (i >= 0)
>
> ------------------------------------------------------
> the following code can show the problem:
>
> #include <stdio.h>
>
>
> int main(int argc, const char **argv)
> {
> int x = '\x';
> printf("%d\n", x);
>
> return 0;
> }
>
> ------------------------------------------------------
> in gcc, it should not be compiled,report error like:
>
>
> main.c: In function ‘main’:
> main.c:6:13: error: \x used with no following hex digits
> int x = '\x';
>
>
> ------------------------------------------------------
> in tcc, it can be compiled. no error!
>
Good find. Amazing that one had escaped attention for so log. And the
fix works.
--
Henry Kroll <nospam@thenerdshow.com>