Ignore inlining with MSVC.

This commit is contained in:
Paul Hübner 2026-01-28 10:13:09 +00:00
parent 0fb953bc21
commit 7b6e657831
3 changed files with 12 additions and 6 deletions

View File

@ -108,10 +108,10 @@ public class TestDwarf {
if (Platform.isX64() || Platform.isX86()) {
// Not all platforms raise SIGFPE but x86_32 and x86_64 do.
runAndCheck(new Flags(TestDwarf.class.getCanonicalName(), "nativeDivByZero"),
new DwarfConstraint(0, "Java_TestDwarf_crashNativeDivByZero", "libTestDwarf.c", 59));
new DwarfConstraint(0, "Java_TestDwarf_crashNativeDivByZero", "libTestDwarf.c", 62));
runAndCheck(new Flags(TestDwarf.class.getCanonicalName(), "nativeMultipleMethods"),
new DwarfConstraint(0, "foo", "libTestDwarf.c", 42),
new DwarfConstraint(1, "Java_TestDwarf_crashNativeMultipleMethods", "libTestDwarf.c", 70));
new DwarfConstraint(0, "foo", "libTestDwarf.c", 45),
new DwarfConstraint(1, "Java_TestDwarf_crashNativeMultipleMethods", "libTestDwarf.c", 73));
}
// Null pointer dereferences exhibit different behaviour depending on if GCC or Clang is used.
// When using GCC, the VM will crash gracefully and generate a hs_err which can be parsed.
@ -119,7 +119,7 @@ public class TestDwarf {
// Since runAndCheck needs an hs_err file, we have to skip this subtest.
if (!isUsingClang()) {
runAndCheck(new Flags(TestDwarf.class.getCanonicalName(), "nativeDereferenceNull"),
new DwarfConstraint(0, "dereference_null", "libTestDwarfHelper.h", 46));
new DwarfConstraint(0, "dereference_null", "libTestDwarfHelper.h", 49));
}
}

View File

@ -29,7 +29,10 @@ int result = 0;
int limit = 20;
// Explicitly don't inline: foo is large enough that GCC won't inline it, but Clang might.
__attribute__((noinline)) void foo(int x) {
#if !defined(_MSC_VER)
__attribute__((noinline))
#endif
void foo(int x) {
printf("foo3:");
printf(" %d\n", x);
for (int i = 0; i < limit; i++) {

View File

@ -41,7 +41,10 @@ void unused4() {
void unused5() {
}
__attribute__((noinline)) EXPORT void dereference_null() {
#if !defined(_MSC_VER)
__attribute__((noinline))
#endif
EXPORT void dereference_null() {
int* x = (int*)0;
*x = 34; // Crash
}