Bug 1389801 - wrong code for vec_vsx_ld
Summary: wrong code for vec_vsx_ld
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gcc
Version: 7.3
Hardware: ppc64le
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jakub Jelinek
QA Contact: Michael Petlan
URL:
Whiteboard:
Depends On:
Blocks: 1390370
TreeView+ depends on / blocked
 
Reported: 2016-10-28 16:56 UTC by Martin Sebor
Modified: 2017-08-01 22:35 UTC (History)
5 users (show)

Fixed In Version: gcc-4.8.5-12.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 22:35:59 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 72863 0 None None None 2016-10-28 17:04:42 UTC
GNU Compiler Collection 78084 0 None None None 2016-10-28 17:03:33 UTC
Red Hat Product Errata RHBA-2017:2094 0 normal SHIPPED_LIVE gcc bug fix update 2017-08-01 19:36:07 UTC

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


Note You need to log in before you can comment on or make changes to this bug.