public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/64003] valgrind complains about get_attr_length_nobnd in insn-attrtab.c from i386.md
Date: Tue, 02 Dec 2014 16:13:00 -0000	[thread overview]
Message-ID: <bug-64003-4-lOmVPNMmkI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64003-4@http.gcc.gnu.org/bugzilla/>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4843 bytes --]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64003

--- Comment #12 from dmalcolm at gcc dot gnu.org ---
(In reply to dmalcolm from comment #11)
> Running valgrind with vgdb to get the precise location of its
> warnings indicates they are here within get_attr_length_nobnd in
> insn-attrtab.c:19152:
> 
> 19147	      if ((((INSN_ADDRESSES_SET_P ()?
> 19148		     INSN_ADDRESSES (INSN_UID
> 19149				     (GET_CODE (operands[0]) ==
> 19150				      LABEL_REF ? XEXP (operands[0],
> 19151							0) : operands[0])) : 0) -
> 19152		    (insn_current_reference_address (insn))) >= (-126))
> 19153		  &&
> 19154		  (((INSN_ADDRESSES_SET_P ()?
> 19155		     INSN_ADDRESSES (INSN_UID
> 19156				     (GET_CODE (operands[0]) ==
> 
> i.e. at the logical-AND at line 19153.
> 
> Valgrind presumably is noticing the "uninitialized" trait of this
> read, then propagating it through to the result of align_fuzz,
> and thence to insn_current_reference_address, and hence to the whole
> of the first argument of the logical-AND.
> 
> Hence the decision about whether to process the second argument of
> the logical-AND is a jump that relies on an uninitialized value, and
> hence valgrind complains.

i.e. the issue is that evaluating both sides of the (and) expression at line
10931 in:

 10920  (define_insn "*jcc_1"
 10921    [(set (pc)
 10922          (if_then_else (match_operator 1 "ix86_comparison_operator"
 10923                                        [(reg FLAGS_REG) (const_int 0)])
 10924                        (label_ref (match_operand 0))
 10925                        (pc)))]
 10926    ""
 10927    "%!%+j%C1\t%l0"
 10928    [(set_attr "type" "ibr")
 10929     (set_attr "modrm" "0")
 10930     (set (attr "length_nobnd")
>10931             (if_then_else (and (ge (minus (match_dup 0) (pc))
 10932                                    (const_int -126))
 10933                                (lt (minus (match_dup 0) (pc))
 10934                                    (const_int 128)))
 10935               (const_int 2)
 10936               (const_int 6)))])
 10937

for a forward jump, leads to reads of uninitialized items from insn_lengths in
align_fuzz for the uid for the jump target.

Hence we have an (and (UNINITIALIZED_1) (WILL_BE_UNINITIALIZED_2)) and hence
the decision about whether to short-circuit the read of WILL_BE_UNINITIALIZED_2
is a conditional jump that depends on UNINITIALIZED_1.
>From gcc-bugs-return-469232-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Dec 02 16:27:01 2014
Return-Path: <gcc-bugs-return-469232-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 24747 invoked by alias); 2 Dec 2014 16:27:01 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 24678 invoked by uid 48); 2 Dec 2014 16:26:55 -0000
From: "nickc at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/64010] [msp430-elf] struct function dereference clobbers parameter passed to function
Date: Tue, 02 Dec 2014 16:27:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: rtl-optimization
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: nickc at redhat dot com
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: cc attachments.created
Message-ID: <bug-64010-4-LyS6EpkuGD@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64010-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64010-4@http.gcc.gnu.org/bugzilla/>
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: 2014-12/txt/msg00239.txt.bz2
Content-length: 546

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd010

Nick Clifton <nickc at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nickc at redhat dot com

--- Comment #2 from Nick Clifton <nickc at redhat dot com> ---
Created attachment 34168
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id4168&actioníit
Patch for reload to avoid using argument regiesters when reloading a call insn


  parent reply	other threads:[~2014-12-02 16:13 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20 18:39 [Bug rtl-optimization/64003] New: " dmalcolm at gcc dot gnu.org
2014-11-20 18:41 ` [Bug rtl-optimization/64003] " dmalcolm at gcc dot gnu.org
2014-11-20 18:54 ` dmalcolm at gcc dot gnu.org
2014-11-20 19:23 ` dmalcolm at gcc dot gnu.org
2014-11-20 19:27 ` dmalcolm at gcc dot gnu.org
2014-11-20 19:41 ` dmalcolm at gcc dot gnu.org
2014-11-21 19:04 ` [Bug target/64003] " dmalcolm at gcc dot gnu.org
2014-12-02  2:20 ` dmalcolm at gcc dot gnu.org
2014-12-02 15:40 ` dmalcolm at gcc dot gnu.org
2014-12-02 15:48 ` dmalcolm at gcc dot gnu.org
2014-12-02 15:54 ` dmalcolm at gcc dot gnu.org
2014-12-02 16:08 ` dmalcolm at gcc dot gnu.org
2014-12-02 16:13 ` dmalcolm at gcc dot gnu.org [this message]
2014-12-04  9:24 ` amylaar at gcc dot gnu.org
2014-12-04 18:43 ` law at redhat dot com
2014-12-04 18:44 ` law at redhat dot com
2014-12-04 19:19 ` amylaar at gcc dot gnu.org
2014-12-04 19:38 ` enkovich.gnu at gmail dot com
2014-12-04 19:45 ` amylaar at gcc dot gnu.org
2014-12-04 19:51 ` law at redhat dot com
2014-12-04 19:54 ` law at redhat dot com
2014-12-05 10:07 ` enkovich.gnu at gmail dot com
2014-12-05 10:08 ` enkovich.gnu at gmail dot com
2014-12-05 10:38 ` ubizjak at gmail dot com
2014-12-05 10:50 ` ubizjak at gmail dot com
2014-12-05 14:19 ` rsandifo at gcc dot gnu.org
2014-12-05 15:01 ` enkovich.gnu at gmail dot com
2014-12-05 16:01 ` ienkovich at gcc dot gnu.org
2015-04-16 14:08 ` ienkovich at gcc dot gnu.org
2015-07-24  8:32 ` ubizjak at gmail dot com
2015-07-24  8:36 ` ubizjak at gmail dot com
2015-07-24 16:26 ` uros at gcc dot gnu.org
2015-07-24 16:31 ` ubizjak at gmail dot com

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-64003-4-lOmVPNMmkI@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: link
Be 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).