[Top][All Lists]

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

[Tinycc-devel] Possible bug in _Generic code, need help to get it fixed

From: K K
Subject: [Tinycc-devel] Possible bug in _Generic code, need help to get it fixed
Date: Fri, 21 Feb 2020 07:13:49 +0000

Hello all,

I got the error message "type match twice" using the following code (built tcc 
from HEAD, running on Windows 10 64 bit):

#include <stdio.h>
void main() {
    const double d = 0;
    printf(_Generic((d), double: "%g", long double: "%Lg", default: 
"<unknown>"), d);

The same problem was already mentioned  

I'm not perfectly in knowing the tcc sources, but in my opinion I discovered 
the source of this problem at line 
https://repo.or.cz/tinycc.git/blob/HEAD:/tccgen.c#l4591 and the following line, 
which changes a correctly parsed type "long double" back to "double" and so 
leads at line https://repo.or.cz/tinycc.git/blob/HEAD:/tccgen.c#l5433 and some 
following lines to the incorrect assumption, that the _Generic definition 
contains two controlling expressions of the same type. This change was done 
back in 2017 by grischka during a long review 

I cannot determine if https://repo.or.cz/tinycc.git/blob/HEAD:/tccgen.c#l4592 
is wrong because I do not know the intension why it was added. And I do not 
know why this type change is done only for PE targets, too. So maybe grischka 
or someone with more knowledge about the tcc sources is able to check this 
again or someone can point me in further directions.

Thanks in advance,

reply via email to

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