[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] miscompilation for code snippet
From: |
Michael Matz |
Subject: |
Re: [Tinycc-devel] miscompilation for code snippet |
Date: |
Tue, 16 Aug 2022 17:01:03 +0200 (CEST) |
User-agent: |
Alpine 2.21 (LSU 202 2017-01-01) |
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" <ntysdd@qq.com>;
Date: Tue, Aug 16, 2022 08:32 PM
To: "tinycc-devel"<tinycc-devel@nongnu.org>;
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.