Bug 1257623 - valgrind testsuite is aborted due to bogus builtins in 32 bit mode
valgrind testsuite is aborted due to bogus builtins in 32 bit mode
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: valgrind (Show other bugs)
7.2
ppc64 Linux
unspecified Severity medium
: rc
: ---
Assigned To: Mark Wielaard
Miloš Prchlík
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-27 09:30 EDT by Miroslav Franc
Modified: 2016-01-31 21:29 EST (History)
6 users (show)

See Also:
Fixed In Version: valgrind-3.10.0-16.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-19 04:05:22 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
KDE Software Compilation 351873 None None None Never

  None (edit)
Description Miroslav Franc 2015-08-27 09:30:17 EDT
Description of problem:
When running valgrind testsuite on ppc64.  We sometimes see the following error:

test_touch_tm.c:11:23: error: builtin __builtin_tabortdc is only valid in 64-bit mode
    __builtin_tabortdc (0,0,0);
                       ^
test_touch_tm.c:12:24: error: builtin __builtin_tabortdci is only valid in 64-bit mode
    __builtin_tabortdci (0,0,0);
                        ^
make[6]: *** [test_touch_tm-test_touch_tm.o] Error 1
make[5]: *** [check-am] Error 2
make[4]: *** [check-recursive] Error 1
make[3]: *** [check-recursive] Error 1
make[2]: *** [check-recursive] Error 1
make[1]: *** [check] Error 2

It aborts entire testsuite.  Which means no results. :(

Version-Release number of selected component (if applicable):
valgrind-3.10.0-14.el7


Steps to Reproduce:
1. make --quiet regtest


The culprit seems to be test_touch_tm.c testcase.

--- test_touch_tm.c ---
#include <stdio.h>

int main (void) {
#ifdef HAS_ISA_2_07
   /* Just get the compiler to generate each of the TM instructions
    * so we can verify that valgrind recognizes them.
    * For now, only the tbegin instruction does anything in valgrind.
    * The rest are just treated as NOPS.
    */
   __builtin_tabort (0);
   __builtin_tabortdc (0,0,0);
   __builtin_tabortdci (0,0,0);
   __builtin_tabortwc (0,0,0);
   __builtin_tabortwci (0,0,0);
   __builtin_tbegin (0);
   __builtin_tend (0);
   //   __builtin_tcheck (0);  tcheck not recognized by compiler
   __builtin_trechkpt ();  // not recognized by early HW
   __builtin_treclaim (0); // not recognized by early HW
   __builtin_tsr (0);
#endif
   return 0;
}
--- --- ---

# gcc -m64 -mhtm -DHAS_ISA_2_07 -Winline -Wall -O -g -mregnames -lm test_touch_tm.c
# gcc -m32 -mhtm -DHAS_ISA_2_07 -Winline -Wall -O -g -mregnames -lm test_touch_tm.c
test_touch_tm.c: In function ‘main’:
test_touch_tm.c:11:23: error: builtin __builtin_tabortdc is only valid in 64-bit mode
    __builtin_tabortdc (0,0,0);
                       ^
test_touch_tm.c:12:24: error: builtin __builtin_tabortdci is only valid in 64-bit mode
    __builtin_tabortdci (0,0,0);
                        ^

Something like the following seems to fix that:

#ifdef __PPC64__
   __builtin_tabortdc (0,0,0);
   __builtin_tabortdci (0,0,0);
#endif
Comment 1 Miroslav Franc 2015-08-27 09:48:39 EDT
Actually, strange thing is that it's in both none/tests/ppc32 and none/tests/ppc64 directories.  I can see that upstream has it only in none/tests/ppc64.
Comment 2 Miroslav Franc 2015-08-27 09:53:31 EDT
(In reply to Miroslav Franc from comment #1)
> Actually, strange thing is that it's in both none/tests/ppc32 and
> none/tests/ppc64 directories.  I can see that upstream has it only in
> none/tests/ppc64.

I take that back.  There's a symlink.
Comment 4 Mark Wielaard 2015-08-27 10:39:41 EDT
This is caused by a stricter gcc which no longer accepts __builtin_tabortdc[i] in -m32 mode. The fix to guard those calls with __PPC64__ looks correct.
Comment 10 Miloš Prchlík 2015-09-23 09:47:49 EDT
Verified for valgrind-3.10.0-16.el7.
Comment 12 errata-xmlrpc 2015-11-19 04:05:22 EST
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://rhn.redhat.com/errata/RHBA-2015-2259.html

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