tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] miscompilation for code snippet


From: ntysdd
Subject: Re: [Tinycc-devel] miscompilation for code snippet
Date: Tue, 16 Aug 2022 20:47:52 +0800

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);
 }


 


------------------ 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
&gt;
&gt; #define G(x) _Generic((x),int*:"int*",void*:"void*")
&gt;
&gt; int printf(const char*, ...);
&gt;
&gt; int main()
&gt; {
&gt;         int y = 0;
&gt;         const char *s = G(1?(void*)(y*0LL):&amp;y);
&gt;         printf("%s\n", s);
&gt; }

expected
void*

actual
int*

Similar constructs are used in Linux kernel.

reply via email to

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