public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at jermar dot eu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/112604] [ia64] Output register not preserved after a branch is not taken
Date: Sat, 18 Nov 2023 16:13:33 +0000	[thread overview]
Message-ID: <bug-112604-4-DV0mqgyRf1@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112604-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Jakub Jermar <jakub at jermar dot eu> ---
Created attachment 56633
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56633&action=edit
Updated requested good object file for vfs_file.c

Seems like -O3 -fno-unswitch-loops makes the bug go away. See the new
attachment for a better example of the good binary and the object file. With
this optimization disabled the argument for the malloc/calloc is set only after
the branch is taken so it does not destroy the argument for
fibril_mutex_unlock():

4000000000001a00 <_vfs_fd_alloc>:
4000000000001a00:       08 48 3d 1a 80 05       [MMI]       alloc
r41=ar.pfs,15,13,0
4000000000001a06:       d0 02 80 00 42 60                   mov r45=r32
4000000000001a0c:       05 00 cc 00                         mov r43=pr
4000000000001a10:       09 38 01 41 00 21       [MMI]       adds r39=64,r32
4000000000001a16:       a0 02 04 00 42 40                   mov r42=r1
4000000000001a1c:       04 10 41 00                         zxt1 r34=r34;;
4000000000001a20:       11 80 00 44 91 39       [MIB]       cmp4.eq
p16,p17=0,r34
4000000000001a26:       80 02 00 62 00 00                   mov r40=b0
4000000000001a2c:       68 b2 01 50                         br.call.sptk.many
b0=400000000001cc80 <fibril_mutex_lock>;;
4000000000001a30:       08 68 01 40 00 21       [MMI]       mov r45=r32
4000000000001a36:       44 02 00 00 42 20             (p16) mov r36=r0
4000000000001a3c:       00 50 01 84                         mov r1=r42
4000000000001a40:       09 70 00 4e 18 10       [MMI]       ld8 r14=[r39]
4000000000001a46:       54 02 00 00 42 c0             (p16) mov r37=r0
4000000000001a4c:       15 00 00 90                         mov r46=1;;
4000000000001a50:       38 22 e1 01 07 64       [MMB] (p17) mov r36=1016
4000000000001a56:       54 fa 03 00 48 00             (p17) mov r37=127
4000000000001a5c:       00 00 00 20                         nop.b 0x0
4000000000001a60:       11 38 00 1c 06 39       [MIB]       cmp.eq p7,p6=0,r14
4000000000001a66:       c0 02 04 65 80 03                   mov.i r44=ar.lc
4000000000001a6c:       f0 03 00 43                   (p07) br.cond.dpnt.few
4000000000001e50 <_vfs_fd_alloc+0x450>;;
4000000000001a70:       10 00 00 00 01 00       [MIB]       nop.m 0x0
4000000000001a76:       00 00 00 02 00 00                   nop.i 0x0
4000000000001a7c:       10 00 00 40                         br.few
4000000000001a80 <_vfs_fd_alloc+0x80>
4000000000001a80:       11 00 00 00 01 00       [MIB]       nop.m 0x0
4000000000001a86:       00 00 00 02 00 00                   nop.i 0x0
4000000000001a8c:       88 b7 01 50                         br.call.sptk.many
b0=400000000001d200 <fibril_mutex_unlock>;;
4000000000001a90:       11 68 01 40 00 21       [MIB]       mov r45=r32
....
4000000000001e50:       11 68 01 00 08 24       [MIB]       mov r45=1024
4000000000001e56:       00 00 00 02 00 00                   nop.i 0x0
4000000000001e5c:       f8 bd 00 50                         br.call.sptk.many
b0=400000000000dc40 <calloc>;;
....

      parent reply	other threads:[~2023-11-18 16:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-18 12:48 [Bug target/112604] New: " jakub at jermar dot eu
2023-11-18 12:51 ` [Bug target/112604] " sjames at gcc dot gnu.org
2023-11-18 13:26 ` jakub at jermar dot eu
2023-11-18 16:13 ` jakub at jermar dot eu [this message]

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-112604-4-DV0mqgyRf1@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).