Thanks for this solution, UnknownGamer. I know you discovered this Problem already some time ago. This works for me, so I use this temporary 😊
Von: UnknownGamer40464 .<mailto:modernwarfare3minecraf...@gmail.com> Gesendet: Freitag, 21. Februar 2020 22:37 An: tinycc-devel@nongnu.org<mailto:tinycc-devel@nongnu.org> Betreff: Re: [Tinycc-devel] Possible bug in _Generic code, need help to get it fixed Not really a solution, but I've found that you can work around it like this: ```c #include <stdio.h> #define numeric_str(X)\ _Generic((X),\ double: "double",\ default:\ _Generic((X)\ long double: "long double",\ int: "int",\ float: "float",\ default: "not a numeric type"\ )\ ) int main(void){ puts(numeric_str(3.14L)); } ``` should print "double" on tcc and work correctly on others, so at least it'll compile. On Fri, Feb 21, 2020 at 10:48 AM K K <kernel.kine...@outlook.de<mailto:kernel.kine...@outlook.de>> wrote: > > 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 > https://lists.gnu.org/archive/html/tinycc-devel/2019-08/msg00012.html. > > 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 > https://repo.or.cz/tinycc.git/commit/1443039416dd02750765efde1af35e31c8d41be3. > > 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, > Kernel > _______________________________________________ > Tinycc-devel mailing list > Tinycc-devel@nongnu.org<mailto:Tinycc-devel@nongnu.org> > https://lists.nongnu.org/mailman/listinfo/tinycc-devel
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel