ColinIanKing / stress-ng

This is the stress-ng upstream project git repository. stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces.
https://github.com/ColinIanKing/stress-ng
GNU General Public License v2.0
1.69k stars 278 forks source link

Build failure on PowerPC 32-bit #395

Closed Sangeetha-E closed 4 months ago

Sangeetha-E commented 4 months ago

Error log:

stress-vecmath.c: In function 'stress_vecmath':
stress-vecmath.c:144:4: internal compiler error: in simplify_subreg, at simplify-rtx.c:5916
  a <<= 1;  \
    ^
stress-vecmath.c:231:4: note: in expansion of macro 'OPS'
    OPS(a64, b64, c64, s64, v23_64, v3_64);
    ^

stress-vecmath.c:144:4: internal compiler error: Segmentation fault
  a <<= 1;  \
    ^
stress-vecmath.c:231:4: note: in expansion of macro 'OPS'
    OPS(a64, b64, c64, s64, v23_64, v3_64);
    ^

Compiler Info:

gcc VERSION=4.9.4

Issue: Does stress-ng support PowerPC 32-bit? While defining STRESS_ARCH, there is no check for PPC 32-bit.

Reference: core-arch.h

Fixup: Here is the fixup to solve the above-mentioned issue. Please review this and provide suggestions for this fix.

diff --git a/core-vecmath.h b/core-vecmath.h
index ea9be28..84fb809 100644
--- a/core-vecmath.h
+++ b/core-vecmath.h
@@ -38,7 +38,7 @@
  *  PPC64 for some reason with some flavours of the toolchain
  *  so disable this test for now
  */
-#if defined(STRESS_ARCH_PPC64) &&      \
+#if defined(STRESS_ARCH_PPC64) || defined (__PPC__) &&     \
     defined(HAVE_COMPILER_GCC_OR_MUSL) &&  \
     __GNUC__ < 6
 #undef HAVE_VECMATH
-- 
ColinIanKing commented 4 months ago

Hi, please try this fix:

git diff --cached
diff --git a/core-arch.h b/core-arch.h
index 7a9cf33f5..efb04e21e 100644
--- a/core-arch.h
+++ b/core-arch.h
@@ -82,6 +82,13 @@
 #define STRESS_OPCODE_MASK     (0xffffffffUL)
 #endif

+/* Arch specific PPC (32 bit ) */
+#if defined(__PPC__)
+#define STRESS_ARCH_PPC                (1)
+#define STRESS_OPCODE_SIZE     (32)
+#define STRESS_OPCODE_MASK     (0xffffffffUL)
+#endif
+
 /* Arch specific M68K */
 #if defined(__m68k__) ||       \
     defined(__mc68000__) ||    \
diff --git a/core-vecmath.h b/core-vecmath.h
index ea9be2825..c9528c7d8 100644
--- a/core-vecmath.h
+++ b/core-vecmath.h
@@ -38,7 +38,8 @@
  *  PPC64 for some reason with some flavours of the toolchain
  *  so disable this test for now
  */
-#if defined(STRESS_ARCH_PPC64) &&              \
+#if (defined(STRESS_ARCH_PPC64) ||             \
+     defined(STRESS_ARCH_PPC)) &&              \
     defined(HAVE_COMPILER_GCC_OR_MUSL) &&      \
     __GNUC__ < 6
 #undef HAVE_VECMATH
Sangeetha-E commented 4 months ago

The fix is works fine. Thank you for your quick response.

ColinIanKing commented 4 months ago

Thank you for testing. Fix applied and pushed to the repository.