From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75399 invoked by alias); 16 Apr 2015 11:20:03 -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 75323 invoked by uid 48); 16 Apr 2015 11:19:59 -0000 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/65780] [5/6 Regression] Uninitialized common handling in executables Date: Thu, 16 Apr 2015 11:20:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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: 2015-04/txt/msg01330.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D65780 --- Comment #14 from H.J. Lu --- (In reply to Jakub Jelinek from comment #10) > (In reply to H.J. Lu from comment #9) > > Created attachment 35327 [details] > > A different patch > >=20 > > On x86, this issue only shows up with PIE. Here is a different > > patch to treat common symbol defined locally only if the backend > > passes true common_maybe_local. For x86-64, it is true only if > > HAVE_LD_PIE_COPYRELOC is 1. For i386, it is always false. If > > we aren't building PIE, common_maybe_local is true or false > > doesn't make a difference for x86 since the common symbol is > > always referenced normally with copy reloc. For PIE on x86-64, > > common symbol is local only if HAVE_LD_PIE_COPYRELOC is 1. >=20 > + > + /* For common symbol, it is defined locally only if common_maybe_local > + is true. */ > + bool defined_locally =3D (!DECL_EXTERNAL (exp) > + && (!DECL_COMMON (exp) || common_maybe_local)); >=20 > I think better would be: > bool uninited_common =3D (DECL_COMMON (exp) > && (DECL_INITIAL (exp) =3D=3D NULL > || (!in_lto_p && DECL_INITIAL (exp) =3D=3D > error_mark_node))); > /* For common symbol, it is defined locally only if common_maybe_local > is true. */ > bool defined_locally =3D (!DECL_EXTERNAL (exp) && (!uninited_common || > common_maybe_local)); > ... > and then use > /* Uninitialized COMMON variable may be unified with symbols > resolved from other modules. */ > if (uninited_common && !resolved_locally) > return false; What does initialized COMMON look like to linker? If it is marked as COMMON symbol to linker, it will be treated the same as uninitialized COMMON symbol. >>From gcc-bugs-return-483779-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Apr 16 11:31:42 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 7502 invoked by alias); 16 Apr 2015 11:31:42 -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 7459 invoked by uid 48); 16 Apr 2015 11:31:38 -0000 From: "schwab@linux-m68k.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/65774] [6.0 regression] FAIL: gcc.dg/builtin-arith-overflow-1.c (internal compiler error) Date: Thu, 16 Apr 2015 11:31:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: schwab@linux-m68k.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 6.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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: 2015-04/txt/msg01331.txt.bz2 Content-length: 167 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65774 --- Comment #3 from Andreas Schwab --- wi::sext has undefined behaviour with offset == 0.