Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1389801

Summary: wrong code for vec_vsx_ld
Product: Red Hat Enterprise Linux 7 Reporter: Martin Sebor <msebor>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Michael Petlan <mpetlan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: law, mcermak, mnewsome, mpetlan, mpolacek
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: gcc-4.8.5-12.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 22:35:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1390370    

Description Martin Sebor 2016-10-28 16:56:28 UTC
GCC 4.8.5 fails the test case submitted in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78084.  A slightly reduced test case is below.  The unused hv variable, the unaligned test, and the vec_vsx_ld call in the call to f are all necessary in order to cause the micompilation.

Code generated by GCC 7 runs successfully to completion.

$ cat t.c && gcc -O1 -Wall -mvsx t.c && ./a.out 
#include <altivec.h>

#define vec_u8_t vector unsigned char

void __attribute__ ((noclone, noinline))
f (vec_u8_t v) { }

static void __attribute__ ((noclone, noinline))
testcase (const unsigned char *dest)
{
  vec_u8_t hv = vec_ld (0, dest);
  (void)&hv;

  vec_u8_t compare = vec_vsx_ld (0, dest);

  if ((unsigned long)dest & 15)
    __builtin_printf ("unaligned address %p\n", dest);

  f (vec_vsx_ld (0, dest));

  if (!vec_all_eq (compare, vec_vsx_ld (0, dest)))
    __builtin_abort ();
}

const unsigned char __attribute__((aligned(16))) buf[] = {
   0,  1,  2,  3,  4,  5,  6,  7,
  10, 11, 12, 13, 14, 15, 16, 17,
  20, 21, 22, 23, 24, 25, 26, 27,
  30, 31, 32, 33, 34, 35, 36, 37,
  40, 41, 42, 43, 44, 45, 46, 47
};

int main (void)
{
  testcase (buf);
  testcase (buf + 8);

  return 0;
}
unaligned address 0x10000928
Aborted

Comment 1 Martin Sebor 2016-10-28 17:07:28 UTC
The fix closest to GCC 4.8 that the upstream bug (72863) points to is:
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=239762

Comment 5 Michael Petlan 2017-05-31 17:54:42 UTC
The related test passes on ppc64le with gcc-4.8.5-14.el7.
VERIFIED.

Comment 6 errata-xmlrpc 2017-08-01 22:35:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2094