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 <nos...@thenerdshow.com>
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to