Bug 351873 - Newer gcc doesn't allow __builtin_tabortdc[i] in ppc32 mode
Summary: Newer gcc doesn't allow __builtin_tabortdc[i] in ppc32 mode
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-27 20:34 UTC by Mark Wielaard
Modified: 2015-09-02 15:43 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2015-08-27 20:34:07 UTC
gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)

gcc -DHAVE_CONFIG_H -I. -I../../..  -I../../.. -I../../../include -I../../../coregrind -I../../../include -I../../../VEX/pub -I../../../VEX/pub -DVGA_ppc64be=1 -DVGO_linux=1 -DVGP_ppc64be_linux=1 -DVGPV_ppc64be_linux_vanilla=1 -DVGA_SEC_ppc32=1 -DVGP_SEC_ppc64be_linux=1  -Winline -Wall -Wshadow -Wno-long-long -g -fno-stack-protector   -m32  -Winline -Wall -O -g -mregnames -mhtm -DSUPPORTS_HTM -DHAS_ISA_2_07 -m32 -mcpu=power8  -MT test_touch_tm-test_touch_tm.o -MD -MP -MF .deps/test_touch_tm-test_touch_tm.Tpo -c -o test_touch_tm-test_touch_tm.o `test -f 'test_touch_tm.c' || echo './'`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);
                        ^


Reproducible: Always




Assuming GCC is correct, this got introduced by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64579

	(htm_expand_builtin): Fix usage of expandedp.  Disallow usage of the
	tabortdc and tabortdci builtins when not in 64-bit mode.

The following patch fixes the valgrind testcase:

diff --git a/none/tests/ppc64/test_touch_tm.c b/none/tests/ppc64/test_touch_tm.c
index 6c0431d..57f89bb 100644
--- a/none/tests/ppc64/test_touch_tm.c
+++ b/none/tests/ppc64/test_touch_tm.c
@@ -8,8 +8,10 @@ int main (void) {
     * The rest are just treated as NOPS.
     */
    __builtin_tabort (0);
+#ifdef __PPC64__
    __builtin_tabortdc (0,0,0);
    __builtin_tabortdci (0,0,0);
+#endif
    __builtin_tabortwc (0,0,0);
    __builtin_tabortwci (0,0,0);
    __builtin_tbegin (0);
Comment 1 Will Schmidt 2015-09-02 15:33:18 UTC
This change looks OK to me. 

As reference, the load/store doubleword instructions are defined only for 64-bit implementations, and would trigger illegal instruction handlers otherwise, so makes sense that the tabortd* instructions would follow that pattern.
Comment 2 Mark Wielaard 2015-09-02 15:43:46 UTC
valgrind svn r15615