Hey,
On Tue, 16 Aug 2022, ntysdd via Tinycc-devel wrote:
Sorry, bad format.
#define G(x) _Generic((x),int*:"int*",void*:"void*")
int printf(const char*, ...);
int main()
{
int y = 0;
const char *s = G(1?(void*)(y*0LL):&y);
printf("%s\n", s);
}
Fixed in mob.
Ciao,
Michael.
____________________________________________________________________________
------------------ Original ------------------
From: "ntysdd" <[email protected]>;
Date: Tue, Aug 16, 2022 08:32 PM
To: "tinycc-devel"<[email protected]>;
Subject: miscompilation for code snippet
TCC gets different result than gcc or clang for code below
>
> #define G(x) _Generic((x),int*:"int*",void*:"void*")
>
> int printf(const char*, ...);
>
> int main()
> {
> int y = 0;
> const char *s = G(1?(void*)(y*0LL):&y);
> printf("%s\n", s);
> }
expected
void*
actual
int*
Similar constructs are used in Linux kernel.
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel