public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/96787] New: rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure
@ 2020-08-26  0:17 acsawdey at gcc dot gnu.org
  2020-08-26  0:18 ` [Bug target/96787] " acsawdey at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: acsawdey at gcc dot gnu.org @ 2020-08-26  0:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96787
           Summary: rs6000 mcpu=power10 miscompiles libiberty
                    htab_delete() causing bootstrap failure
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acsawdey at gcc dot gnu.org
  Target Milestone: ---

Created attachment 49122
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49122&action=edit
hashtab.c with no added attributes

Building r11-2827 configured using --with-cpu=power10, I am seeing some kind of
compile failure in libiberty hashtab.o function htab_delete(). Putting
__attribute__ ((target("cpu=power9")) in front of that function clears the
problem.

The manifestation is that genmddeps segfaults.

I've attached asm output with (.fixed.s) and without (.broken.s) the attribute
on htab_delete().

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure
  2020-08-26  0:17 [Bug target/96787] New: rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure acsawdey at gcc dot gnu.org
@ 2020-08-26  0:18 ` acsawdey at gcc dot gnu.org
  2020-08-26  0:24 ` acsawdey at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: acsawdey at gcc dot gnu.org @ 2020-08-26  0:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from acsawdey at gcc dot gnu.org ---
Created attachment 49123
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49123&action=edit
hashtab.c with target power9 attribute on htab_delete()

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure
  2020-08-26  0:17 [Bug target/96787] New: rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure acsawdey at gcc dot gnu.org
  2020-08-26  0:18 ` [Bug target/96787] " acsawdey at gcc dot gnu.org
@ 2020-08-26  0:24 ` acsawdey at gcc dot gnu.org
  2020-08-26  0:28 ` acsawdey at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: acsawdey at gcc dot gnu.org @ 2020-08-26  0:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from acsawdey at gcc dot gnu.org ---
I'm seeing some load-past-store code motion that happens when compiling for
power10 vs power9 that makes me suspicious.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure
  2020-08-26  0:17 [Bug target/96787] New: rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure acsawdey at gcc dot gnu.org
  2020-08-26  0:18 ` [Bug target/96787] " acsawdey at gcc dot gnu.org
  2020-08-26  0:24 ` acsawdey at gcc dot gnu.org
@ 2020-08-26  0:28 ` acsawdey at gcc dot gnu.org
  2020-08-26  1:14 ` dje at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: acsawdey at gcc dot gnu.org @ 2020-08-26  0:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from acsawdey at gcc dot gnu.org ---
Never mind that, all I'm seeing is the lack of save/restore of r2 in the
power10 version.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure
  2020-08-26  0:17 [Bug target/96787] New: rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure acsawdey at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-08-26  0:28 ` acsawdey at gcc dot gnu.org
@ 2020-08-26  1:14 ` dje at gcc dot gnu.org
  2020-08-26  2:18 ` wschmidt at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dje at gcc dot gnu.org @ 2020-08-26  1:14 UTC (permalink / raw)
  To: gcc-bugs

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

David Edelsohn <dje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-08-26
   Target Milestone|---                         |10.2
                 CC|                            |bergner at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #4 from David Edelsohn <dje at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure
  2020-08-26  0:17 [Bug target/96787] New: rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure acsawdey at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-08-26  1:14 ` dje at gcc dot gnu.org
@ 2020-08-26  2:18 ` wschmidt at gcc dot gnu.org
  2020-08-26  2:39 ` wschmidt at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2020-08-26  2:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
The divergence occurs after .L75 in the two versions.  In the P10 version, we
see that the second bctrl has been converted into a bctr.  It looks like a tail
call optimization happening, but we aren't at the end of the function.  This
happens again later for the second bctrl after .L78.

Why would we think a tail call optimization can happen in the middle of a
block...

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure
  2020-08-26  0:17 [Bug target/96787] New: rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure acsawdey at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-08-26  2:18 ` wschmidt at gcc dot gnu.org
@ 2020-08-26  2:39 ` wschmidt at gcc dot gnu.org
  2020-08-26  2:57 ` wschmidt at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2020-08-26  2:39 UTC (permalink / raw)
  To: gcc-bugs

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

Bill Schmidt <wschmidt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amodra at gcc dot gnu.org

--- Comment #6 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Ah, I can't read.  These really are at the end(s) of the function, so it does
appear to be a tail call optimization that we've decided is legitimate.

It looks like the problem is that we don't set up r12 prior to the tail call. 
Unlike the usual case, here we have "mtctr 9" to set up the CTR and r12 still
points to the previously called function.  That can't be good.

This is exposed by my recent patch to allow more tail calls in
rs6000_decl_ok_for_sibcall, but it's not clear to me where we need to fix
things up so that r12 gets set.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure
  2020-08-26  0:17 [Bug target/96787] New: rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure acsawdey at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-08-26  2:39 ` wschmidt at gcc dot gnu.org
@ 2020-08-26  2:57 ` wschmidt at gcc dot gnu.org
  2020-08-26 21:12 ` wschmidt at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2020-08-26  2:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
I believe the problem may be that rs6000_sibcall_aix doesn't contain any
handling for indirect calls, whereas similar code for other ABIs, like
rs6000_sibcall_sysv, does.  Alan, does this make sense?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure
  2020-08-26  0:17 [Bug target/96787] New: rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure acsawdey at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-08-26  2:57 ` wschmidt at gcc dot gnu.org
@ 2020-08-26 21:12 ` wschmidt at gcc dot gnu.org
  2020-08-27 16:18 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2020-08-26 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
I'm working on a patch.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure
  2020-08-26  0:17 [Bug target/96787] New: rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure acsawdey at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2020-08-26 21:12 ` wschmidt at gcc dot gnu.org
@ 2020-08-27 16:18 ` cvs-commit at gcc dot gnu.org
  2020-08-27 16:31 ` wschmidt at gcc dot gnu.org
  2022-03-13  7:37 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-27 16:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by William Schmidt <wschmidt@gcc.gnu.org>:

https://gcc.gnu.org/g:abca87c57847cd04f5e05935ff9ae5121c1ecb1d

commit r11-2908-gabca87c57847cd04f5e05935ff9ae5121c1ecb1d
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Aug 27 11:17:06 2020 -0500

    rs6000: Support ELFv2 sibcall for indirect calls [PR96787]

    Prior to P10, ELFv2 hasn't implemented nonlocal sibcalls.  Now that we do,
    we need to be sure that r12 is set up prior to such a call.

    2020-08-27  Bill Schmidt  <wschmidt@linux.ibm.com>

    gcc/
            PR target/96787
            * config/rs6000/rs6000.c (rs6000_sibcall_aix): Support
            indirect call for ELFv2.

    gcc/testsuite/

            PR target/96787
            * gcc.target/powerpc/pr96787-1.c: New.
            * gcc.target/powerpc/pr96787-2.c: New.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure
  2020-08-26  0:17 [Bug target/96787] New: rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure acsawdey at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2020-08-27 16:18 ` cvs-commit at gcc dot gnu.org
@ 2020-08-27 16:31 ` wschmidt at gcc dot gnu.org
  2022-03-13  7:37 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2020-08-27 16:31 UTC (permalink / raw)
  To: gcc-bugs

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

Bill Schmidt <wschmidt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Work is complete.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/96787] rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure
  2020-08-26  0:17 [Bug target/96787] New: rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure acsawdey at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2020-08-27 16:31 ` wschmidt at gcc dot gnu.org
@ 2022-03-13  7:37 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-03-13  7:37 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.2                        |11.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-03-13  7:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26  0:17 [Bug target/96787] New: rs6000 mcpu=power10 miscompiles libiberty htab_delete() causing bootstrap failure acsawdey at gcc dot gnu.org
2020-08-26  0:18 ` [Bug target/96787] " acsawdey at gcc dot gnu.org
2020-08-26  0:24 ` acsawdey at gcc dot gnu.org
2020-08-26  0:28 ` acsawdey at gcc dot gnu.org
2020-08-26  1:14 ` dje at gcc dot gnu.org
2020-08-26  2:18 ` wschmidt at gcc dot gnu.org
2020-08-26  2:39 ` wschmidt at gcc dot gnu.org
2020-08-26  2:57 ` wschmidt at gcc dot gnu.org
2020-08-26 21:12 ` wschmidt at gcc dot gnu.org
2020-08-27 16:18 ` cvs-commit at gcc dot gnu.org
2020-08-27 16:31 ` wschmidt at gcc dot gnu.org
2022-03-13  7:37 ` pinskia at gcc dot gnu.org

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).