public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "zhan3299 at purdue dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/99211] New: gcc fails on program which overrides __builtin_clzll Date: Tue, 23 Feb 2021 03:32:29 +0000 [thread overview] Message-ID: <bug-99211-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99211 Bug ID: 99211 Summary: gcc fails on program which overrides __builtin_clzll Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: zhan3299 at purdue dot edu Target Milestone: --- GCC fails to compile the attached code: https://godbolt.org/z/sdqq3M One interesting thing is that, only when we override __builtin_clzll this issue will occur. If we replace the __builtin_clzll as any other builtin function (e.g., __builtin_expect), GCC will accept the program with a conflicting type warning: https://godbolt.org/z/5c45T6 For other compilers, Clang rejects such conflicts with built-in functions: https://godbolt.org/z/9WzTKP Icc accepts and successfully compiles it (with warnings): https://godbolt.org/z/W4zK89 $ cat test.c struct S { int a; }; struct S __builtin_clzll(long x) { if (x == 1) { struct S y = { .a = 1 }; return y; } else { struct S y = { .a = __builtin_clzll(1).a + 1 }; return y; } } int main() { return __builtin_clzll(10).a; } $ gcc test.c test.c: In function '__builtin_clzll': test.c:10:16: internal compiler error: in wide_int_to_tree_1, at tree.c:1644 10 | struct S y = { .a = __builtin_clzll(1).a + 1 }; | ^ 0x1a31d99 internal_error(char const*, ...) ???:0 0x6877ad fancy_abort(char const*, int, char const*) ???:0 0x9bed4a fold_build_call_array_loc(unsigned int, tree_node*, tree_node*, int, tree_node**) ???:0 0x6e1010 build_function_call_vec(unsigned int, vec<unsigned int, va_heap, vl_ptr>, tree_node*, vec<tree_node*, va_gc, vl_embed>*, vec<tree_node*, va_gc, vl_embed>*, tree_node*) ???:0 0x7322e9 c_parse_file() ???:0 0x7a02c2 c_common_parse_file() ???:0 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.
next reply other threads:[~2021-02-23 3:32 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-23 3:32 zhan3299 at purdue dot edu [this message] 2021-02-23 8:27 ` [Bug c/99211] " rguenth at gcc dot gnu.org 2021-02-23 9:08 ` jakub at gcc dot gnu.org 2021-02-23 10:29 ` redi at gcc dot gnu.org 2021-02-23 10:50 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-99211-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).