public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "siddhesh at redhat dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug libc/17266] New: Always defining __extern_always_inline may generate infinite recursion Date: Thu, 14 Aug 2014 00:34:00 -0000 [thread overview] Message-ID: <bug-17266-131@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=17266 Bug ID: 17266 Summary: Always defining __extern_always_inline may generate infinite recursion Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: libc Assignee: siddhesh at redhat dot com Reporter: siddhesh at redhat dot com CC: drepper.fsp at gmail dot com The fix for bug 14530 and bug 13741 cause a regression that may cause older compilers to generate infinite recursion for wrapper functions that rely on GNU extern inline semantics of newer compiler versions, i.e. g++4.3 and later. Consider say: #include <wchar.h> volatile int i = ' '; wint_t (*fn) (int) = btowc; int main () { asm (""); i = fn (i); return 0; } When this is compiled e.g. with g++ 3.2, because of the incorrect BZ #14530, #13741 fix, the program will recurse endlessly. That is because g++ < 4.3 only provided the C++ inline semantics, not gnu_inline, but when glibc headers use __extern_inline, __extern_always_inline or __fortify_function, they rely on GNU extern inline semantics. The C++ inline semantics when btowc can't be inlined is that the compiler emits a comdat out of line, but btowc is: extern wint_t __btowc_alias (int __c) __asm ("btowc"); __extern_inline wint_t __NTH (btowc (int __c)) { return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f' ? (wint_t) __c : __btowc_alias (__c)); } When the compiler emits out of line copy of this, it will be e.g. on i?86/x86_64 .globl btowc; btowc: jmp btowc; Similarly with any other __extern_*inline functions in glibc headers that sometimes call the original function through aliases. One can get the problematic definitions out of line even with -fkeep-inline-functions and similar. The code before these fixes was the most reliable way to handle this, so the above bugs ought to be fixed in a different manner. -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2014-08-14 0:34 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-08-14 0:34 siddhesh at redhat dot com [this message] 2014-08-14 11:45 ` [Bug libc/17266] " jakub at redhat dot com 2014-08-14 16:45 ` schwab@linux-m68k.org 2014-08-14 16:50 ` jakub at redhat dot com 2014-09-16 8:41 ` cvs-commit at gcc dot gnu.org 2014-09-16 8:46 ` cvs-commit at gcc dot gnu.org 2014-09-16 8:47 ` siddhesh at redhat dot com 2014-09-16 16:56 ` cvs-commit 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-17266-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.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).