public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/115026] New: msp430-elf fails gcc.dg/pr66444.c with prange enabled
@ 2024-05-10  9:42 aldyh at gcc dot gnu.org
  2024-05-10  9:43 ` [Bug tree-optimization/115026] " aldyh at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: aldyh at gcc dot gnu.org @ 2024-05-10  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115026
           Summary: msp430-elf fails gcc.dg/pr66444.c with prange enabled
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aldyh at gcc dot gnu.org
  Target Milestone: ---

This is a separate issue reported by Jeff in PR115009.  I have reproduced on a
cross compiler.

Copied below is his report:

And on msp430-elf we're getting a codegen correctness issue on msp430-elf. 
gcc.dg/pr66444.c fails in the simulator.  The -O2 code difference looks like:

*** good.s      Thu May  9 20:41:37 2024
--- bad.s       Thu May  9 20:41:44 2024
*************** baz:
*** 73,81 ****
  ; saved regs:(none)
        ; start of prologue
        ; end of prologue
!       MOV.W   #2062, R12
        CALL    #fn1
!       MOV.W   #2062, R12
        CALL    #fn2
        MOV.B   #0, R12
        ; start of epilogue
--- 73,81 ----
  ; saved regs:(none)
        ; start of prologue
        ; end of prologue
!       MOV.B   #0, R12
        CALL    #fn1
!       MOV.B   #0, R12
        CALL    #fn2
        MOV.B   #0, R12
        ; start of epilogue


We're mucking up the pointer that baz() passes down to fn1 and fn2 I think.

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

* [Bug tree-optimization/115026] msp430-elf fails gcc.dg/pr66444.c with prange enabled
  2024-05-10  9:42 [Bug tree-optimization/115026] New: msp430-elf fails gcc.dg/pr66444.c with prange enabled aldyh at gcc dot gnu.org
@ 2024-05-10  9:43 ` aldyh at gcc dot gnu.org
  2024-05-10 10:36 ` aldyh at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: aldyh at gcc dot gnu.org @ 2024-05-10  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |aldyh at gcc dot gnu.org
   Last reconfirmed|                            |2024-05-10

--- Comment #1 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
All mine baby!

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

* [Bug tree-optimization/115026] msp430-elf fails gcc.dg/pr66444.c with prange enabled
  2024-05-10  9:42 [Bug tree-optimization/115026] New: msp430-elf fails gcc.dg/pr66444.c with prange enabled aldyh at gcc dot gnu.org
  2024-05-10  9:43 ` [Bug tree-optimization/115026] " aldyh at gcc dot gnu.org
@ 2024-05-10 10:36 ` aldyh at gcc dot gnu.org
  2024-05-10 10:37 ` aldyh at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: aldyh at gcc dot gnu.org @ 2024-05-10 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
OK, this is embarrassing.

We are incorrectly folding a POINTER_PLUS_EXPR range operation:

 Folding statement: x_7 = 2048B + _2;
-Queued stmt for removal.  Folds to: 2062B
+Queued stmt for removal.  Folds to: 0B

The reason is that the prange::update_bitmask() code is ignoring its operand
and using the current bitmask.

I have no idea how this bootstrapped *any* architecture.  I suppose it needs a
value/mask pair (0xe / 0x0) for the second operand that actually indicates a
singleton.  *shrug*

Thanks for reporting this.

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

* [Bug tree-optimization/115026] msp430-elf fails gcc.dg/pr66444.c with prange enabled
  2024-05-10  9:42 [Bug tree-optimization/115026] New: msp430-elf fails gcc.dg/pr66444.c with prange enabled aldyh at gcc dot gnu.org
  2024-05-10  9:43 ` [Bug tree-optimization/115026] " aldyh at gcc dot gnu.org
  2024-05-10 10:36 ` aldyh at gcc dot gnu.org
@ 2024-05-10 10:37 ` aldyh at gcc dot gnu.org
  2024-05-10 10:38 ` aldyh at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: aldyh at gcc dot gnu.org @ 2024-05-10 10:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Created attachment 58169
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58169&action=edit
proposed patch

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

* [Bug tree-optimization/115026] msp430-elf fails gcc.dg/pr66444.c with prange enabled
  2024-05-10  9:42 [Bug tree-optimization/115026] New: msp430-elf fails gcc.dg/pr66444.c with prange enabled aldyh at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-05-10 10:37 ` aldyh at gcc dot gnu.org
@ 2024-05-10 10:38 ` aldyh at gcc dot gnu.org
  2024-05-10 12:41 ` [Bug tree-optimization/115026] [15 Regression] " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: aldyh at gcc dot gnu.org @ 2024-05-10 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Jeff, if you still have your tree around, could you try this patch?

I'll queue it with the rest of patches I will push before enabling prange when
the IPA issues are sorted out.

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

* [Bug tree-optimization/115026] [15 Regression] msp430-elf fails gcc.dg/pr66444.c with prange enabled
  2024-05-10  9:42 [Bug tree-optimization/115026] New: msp430-elf fails gcc.dg/pr66444.c with prange enabled aldyh at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-05-10 10:38 ` aldyh at gcc dot gnu.org
@ 2024-05-10 12:41 ` rguenth at gcc dot gnu.org
  2024-05-10 14:57 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-10 12:41 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|msp430-elf fails            |[15 Regression] msp430-elf
                   |gcc.dg/pr66444.c with       |fails gcc.dg/pr66444.c with
                   |prange enabled              |prange enabled
            Version|unknown                     |15.0
           Keywords|                            |wrong-code
   Target Milestone|---                         |15.0

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

* [Bug tree-optimization/115026] [15 Regression] msp430-elf fails gcc.dg/pr66444.c with prange enabled
  2024-05-10  9:42 [Bug tree-optimization/115026] New: msp430-elf fails gcc.dg/pr66444.c with prange enabled aldyh at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-05-10 12:41 ` [Bug tree-optimization/115026] [15 Regression] " rguenth at gcc dot gnu.org
@ 2024-05-10 14:57 ` cvs-commit at gcc dot gnu.org
  2024-05-10 15:09 ` aldyh at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-10 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Aldy Hernandez <aldyh@gcc.gnu.org>:

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

commit r15-363-gcbd420a1c3e2bb549dc83b53cc9a31aa6b23952c
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Fri May 10 12:26:49 2024 +0200

    [prange] Fix thinko in prange::update_bitmask() [PR115026]

    gcc/ChangeLog:

            PR tree-optimization/115026
            * value-range.cc (prange::update_bitmask): Use operand bitmask.

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

* [Bug tree-optimization/115026] [15 Regression] msp430-elf fails gcc.dg/pr66444.c with prange enabled
  2024-05-10  9:42 [Bug tree-optimization/115026] New: msp430-elf fails gcc.dg/pr66444.c with prange enabled aldyh at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-05-10 14:57 ` cvs-commit at gcc dot gnu.org
@ 2024-05-10 15:09 ` aldyh at gcc dot gnu.org
  2024-05-10 18:01 ` law at gcc dot gnu.org
  2024-05-10 20:57 ` aldyh at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: aldyh at gcc dot gnu.org @ 2024-05-10 15:09 UTC (permalink / raw)
  To: gcc-bugs

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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #6 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
This fixes the PR, but since prange is currently disabled, let's keep it open
until it's re-enabled.

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

* [Bug tree-optimization/115026] [15 Regression] msp430-elf fails gcc.dg/pr66444.c with prange enabled
  2024-05-10  9:42 [Bug tree-optimization/115026] New: msp430-elf fails gcc.dg/pr66444.c with prange enabled aldyh at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-05-10 15:09 ` aldyh at gcc dot gnu.org
@ 2024-05-10 18:01 ` law at gcc dot gnu.org
  2024-05-10 20:57 ` aldyh at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: law at gcc dot gnu.org @ 2024-05-10 18:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jeffrey A. Law <law at gcc dot gnu.org> ---
So what's the magic to re-enable prange?  I can do that and spin a fresh build.

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

* [Bug tree-optimization/115026] [15 Regression] msp430-elf fails gcc.dg/pr66444.c with prange enabled
  2024-05-10  9:42 [Bug tree-optimization/115026] New: msp430-elf fails gcc.dg/pr66444.c with prange enabled aldyh at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-05-10 18:01 ` law at gcc dot gnu.org
@ 2024-05-10 20:57 ` aldyh at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: aldyh at gcc dot gnu.org @ 2024-05-10 20:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Jeffrey A. Law from comment #7)
> So what's the magic to re-enable prange?  I can do that and spin a fresh
> build.

You could revert this patch:

commit d7bb8eaade3cd3aa70715c8567b4d7b08098e699 (master, clean)
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Fri May 10 00:29:13 2024 +0200

    Revert: "Enable prange support." [PR114985]

    This reverts commit 36e877996936abd8bd08f8b1d983c8d1023a5842 until the IPA
    pass is fixed with regards to POINTER = POINTER <RELOP> POINTER.

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

end of thread, other threads:[~2024-05-10 20:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-10  9:42 [Bug tree-optimization/115026] New: msp430-elf fails gcc.dg/pr66444.c with prange enabled aldyh at gcc dot gnu.org
2024-05-10  9:43 ` [Bug tree-optimization/115026] " aldyh at gcc dot gnu.org
2024-05-10 10:36 ` aldyh at gcc dot gnu.org
2024-05-10 10:37 ` aldyh at gcc dot gnu.org
2024-05-10 10:38 ` aldyh at gcc dot gnu.org
2024-05-10 12:41 ` [Bug tree-optimization/115026] [15 Regression] " rguenth at gcc dot gnu.org
2024-05-10 14:57 ` cvs-commit at gcc dot gnu.org
2024-05-10 15:09 ` aldyh at gcc dot gnu.org
2024-05-10 18:01 ` law at gcc dot gnu.org
2024-05-10 20:57 ` aldyh 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).