From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19312 invoked by alias); 20 Nov 2013 01:03:32 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19164 invoked by uid 48); 20 Nov 2013 01:03:28 -0000 From: "luto at mit dot edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/59197] New: An alias from an always_inline function causes inconsistent behavior Date: Wed, 20 Nov 2013 01:03:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: luto at mit dot edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-11/txt/msg01932.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D59197 Bug ID: 59197 Summary: An alias from an always_inline function causes inconsistent behavior Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: luto at mit dot edu This program: extern void func(void); extern __inline __attribute__((__always_inline__)) __attribute__((__gnu_inline__)) void func(void) { } extern void alias_target_func(void) {} extern void func(void) __attribute__((alias("alias_target_func"))); extern void caller(void) { func(); } fails to compile on 4.7, 4.8, and trunk with -c -fPIC -O2, saying: inline_alias.c: In function =E2=80=98caller=E2=80=99: inline_alias.c:5:13: error: inlining failed in call to always_inline =E2=80= =98func=E2=80=99: function body can be overwritten at link time extern void func(void) __attribute__((alias("alias_target_func"))); ^ inline_alias.c:9:7: error: called from here func(); ^ It compiles on an old copy of gcc 4.5 I have lying around, although I don't think I agree with the generated code. gcc 4.5.1 (and gcc 4.8.2 with -O0) emit the call to func. With the alias removed, the call to func is not emitted, even at -O0. Oddly, without -fPI= C, gcc 4.8 and trunk inline the call to func. trunk's behavior with -O0 (w/o -fPIC) is even stranger: it emits a call to alias_target_func. I can't reproduce that with other flags or on gcc 4.8. I think that the correct behavior would be to either (a) reject the alias a= s a redefinition of func or (b) accept this code as valid and inline func. Giv= en the documented behavior for "extern __attribute__((gnu_inline))", the inline version of func should be used (or this code should be rejected outright). This may be related to PR33763 or PR46596, but I don't think it's the same issue as either one, although the respective fixes could be involved in the behavior changes. It came up in practice when openonload-201310 failed to build with _FORTIFY_SOURCE=3D2. >>From gcc-bugs-return-435156-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Nov 20 01:10:50 2013 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 25793 invoked by alias); 20 Nov 2013 01:10:49 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 25435 invoked by uid 48); 20 Nov 2013 01:10:12 -0000 From: "law at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/48801] uninitialized warning for variables used only in loop body and initialized in the first iteration Date: Wed, 20 Nov 2013 01:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: law at redhat dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cc resolution Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-11/txt/msg01933.txt.bz2 Content-length: 539 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48801 Jeffrey A. Law changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |law at redhat dot com Resolution|--- |WORKSFORME --- Comment #2 from Jeffrey A. Law --- gcc-4.8 and the trunk seem to handle this just fine.