GCC Miscompilation of vector shift

Bug #1837522 reported by bugproxy
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu on IBM z Systems
Fix Released
High
Matthias Klose
gcc-5 (Ubuntu)
Invalid
Undecided
Unassigned
gcc-6 (Ubuntu)
Won't Fix
Wishlist
Unassigned
gcc-7 (Ubuntu)
Fix Released
High
Unassigned
Bionic
Fix Released
Undecided
Unassigned
Disco
Won't Fix
Undecided
Unassigned
gcc-8 (Ubuntu)
Fix Released
High
Skipper Bug Screeners
Bionic
Fix Released
Undecided
Unassigned
Disco
Won't Fix
Undecided
Unassigned

Bug Description

Vector shift miscompilation

---Steps to Reproduce---
   t.c:
__vector int
foo (__vector int a, int s)
{
  return a << (s + 3);
}

gcc -O3 -march=z13 t.c -S -mzvector

foo:
        veslf %v24,%v24,0(%r2) <---- +3 is omitted
        br %r14

Contact Information = <email address hidden>

Userspace tool common name: GCC

The userspace tool has the following bit modes: 64

Backported fix has been applied to GCC 8 branch as r273493:

https://gcc.gnu.org/viewcvs?rev=273493&root=gcc&view=rev

S/390: Fix vector shift count operand

We currently use subst definitions to handle the different variants of shift
count operands. Unfortunately, in the vector shift pattern the shift count
operand is used directly. Without it being adjusted for the 'subst' variants the
displacement value is omitted resulting in a wrong shift count being applied.

This patch needs to be applied to older branches as well.

gcc/ChangeLog:

2019-07-15 Andreas Krebbel <email address hidden>

Backport from mainline
2019-07-01 Andreas Krebbel <email address hidden>

* config/s390/vector.md: Fix shift count operand printing.

gcc/testsuite/ChangeLog:

2019-07-15 Andreas Krebbel <email address hidden>

Backport from mainline
2019-07-01 Andreas Krebbel <email address hidden>

* gcc.target/s390/vector/vec-shift-2.c: New test.

Added:
branches/gcc-8-branch/gcc/testsuite/gcc.target/s390/vector/vec-shift-2.c
Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/config/s390/vector.md
branches/gcc-8-branch/gcc/testsuite/ChangeLog

bugproxy (bugproxy)
tags: added: architecture-s39064 bugnameltc-179280 severity-high targetmilestone-inin---
Changed in ubuntu:
assignee: nobody → Skipper Bug Screeners (skipper-screen-team)
affects: ubuntu → linux (Ubuntu)
Frank Heimes (fheimes)
affects: linux (Ubuntu) → gcc-8 (Ubuntu)
Changed in ubuntu-z-systems:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Matthias Klose (doko)
Revision history for this message
Matthias Klose (doko) wrote :

that's on the gcc-7 branch as well. Is it needed on older branches as well?

Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2019-07-24 03:53 EDT-------
(In reply to comment #5)
> that's on the gcc-7 branch as well. Is it needed on older branches as well?

Yes, the problem is in all GCC branches starting with GCC 6.

tags: added: id-5d37a11c04114c8bb6452ed4
Revision history for this message
Matthias Klose (doko) wrote :

the fix for GCC 6 may be not needed, as it's not the default compiler in any supported release. However GCC 5 needs the fix for 18.06 LTS.

Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2019-08-01 02:49 EDT-------
(In reply to comment #7)
> the fix for GCC 6 may be not needed, as it's not the default compiler in any
> supported release. However GCC 5 needs the fix for 18.06 LTS.

GCC 5 is ok as is. The patch introducing the problem went into GCC 6.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Adjusted statuses as per above comments.

Changed in gcc-5 (Ubuntu):
status: New → Invalid
Changed in gcc-6 (Ubuntu):
status: New → Confirmed
importance: Undecided → Wishlist
Changed in gcc-7 (Ubuntu):
status: New → Triaged
importance: Undecided → High
Changed in gcc-8 (Ubuntu):
status: New → Triaged
importance: Undecided → High
Steve Langasek (vorlon)
Changed in gcc-6 (Ubuntu):
status: Confirmed → Won't Fix
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I've updated lots of series tasks and statuses.
Probably best viewed on launchpad https://bugs.launchpad.net/ubuntu/+source/gcc-8/+bug/1837522

Summary:

gcc-7 & gcc-8 are fixed in Eoan and Focal

Disco will go end of life soon, and is marked as Won't Fix, as there is not enough time to complete toolchain SRU prior to its End of Life.

Bionic update is in progress, with test rebuild results being analyzed. However, gcc 7.5 was recently announced for November. We are evaluating doing two gcc-7 SRUs with current results, and then later with 7.5. Or we might postpone currently inflight gcc-7 SRU and include this fix with the gcc 7.5 targetting security pocket.

no longer affects: gcc-5 (Ubuntu Bionic)
no longer affects: gcc-5 (Ubuntu Disco)
no longer affects: gcc-6 (Ubuntu Bionic)
no longer affects: gcc-6 (Ubuntu Disco)
Changed in gcc-7 (Ubuntu):
status: Triaged → Fix Released
Changed in gcc-7 (Ubuntu Disco):
status: New → Won't Fix
Changed in gcc-7 (Ubuntu Bionic):
status: New → Triaged
Changed in gcc-8 (Ubuntu):
status: Triaged → Fix Released
Changed in gcc-8 (Ubuntu Disco):
status: New → Won't Fix
Changed in gcc-8 (Ubuntu Bionic):
status: New → Triaged
Frank Heimes (fheimes)
Changed in ubuntu-z-systems:
status: Triaged → In Progress
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

gcc-7.5 is now in bionic-updates.

Changed in gcc-7 (Ubuntu Bionic):
status: Triaged → Fix Released
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

gcc-8.4 update cycle has now started at https://bugs.launchpad.net/ubuntu/+source/gcc-8/+bug/1866835

it will take a while, but hopefully a lot less than the last 7.5 update which hit a lot of QA automation roadblocks, which we have now resolved.

bugproxy (bugproxy)
tags: added: targetmilestone-inin1804
removed: targetmilestone-inin---
Changed in gcc-8 (Ubuntu Bionic):
status: Triaged → Fix Committed
Frank Heimes (fheimes)
Changed in ubuntu-z-systems:
status: In Progress → Fix Committed
Changed in gcc-8 (Ubuntu Bionic):
status: Fix Committed → Fix Released
Changed in ubuntu-z-systems:
status: Fix Committed → Fix Released
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2020-04-09 02:57 EDT-------
IBM Bugzilla status->closed. Fix Released for all requested packages

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.