Some backends do not define TARGET_ASM_OUTPUT_MI_THUNK. But the generic thunk support cannot emit code for calling variadic methods of multiple-inheritance classes. Example error for pru-unknown-elf:
.../gcc/gcc/testsuite/g++.dg/ipa/pr83549.C:7:24: error: generic thunk code fails for method 'virtual void C::_ZThn4_N1C3fooEz(...)' which uses '...' Disable the affected tests for all targets which do not define TARGET_ASM_OUTPUT_MI_THUNK. Ensured that test results with and without this patch for x86_64-pc-linux-gnu are the same. Ok for trunk? gcc/testsuite/ChangeLog: * g++.dg/ipa/pr83549.C: Require effective target variadic_mi_thunk. * g++.dg/ipa/pr83667.C: Ditto. * g++.dg/torture/pr81812.C: Ditto. * g++.old-deja/g++.jason/thunk3.C: Ditto. * lib/target-supports.exp (check_effective_target_variadic_mi_thunk): New function. Signed-off-by: Dimitar Dimitrov <dimi...@dinux.eu> --- gcc/testsuite/g++.dg/ipa/pr83549.C | 1 + gcc/testsuite/g++.dg/ipa/pr83667.C | 1 + gcc/testsuite/g++.dg/torture/pr81812.C | 1 + gcc/testsuite/g++.old-deja/g++.jason/thunk3.C | 3 +- gcc/testsuite/lib/target-supports.exp | 31 +++++++++++++++++++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/g++.dg/ipa/pr83549.C b/gcc/testsuite/g++.dg/ipa/pr83549.C index 90cf8fe7e0d..3b4547b71df 100644 --- a/gcc/testsuite/g++.dg/ipa/pr83549.C +++ b/gcc/testsuite/g++.dg/ipa/pr83549.C @@ -1,5 +1,6 @@ // PR ipa/83549 // { dg-do compile } +// { dg-require-effective-target variadic_mi_thunk } // { dg-options "-O2" } struct A { virtual ~A (); }; diff --git a/gcc/testsuite/g++.dg/ipa/pr83667.C b/gcc/testsuite/g++.dg/ipa/pr83667.C index a8a5a5adb3a..ec91a2ebd33 100644 --- a/gcc/testsuite/g++.dg/ipa/pr83667.C +++ b/gcc/testsuite/g++.dg/ipa/pr83667.C @@ -1,6 +1,7 @@ // { dg-require-alias "" } // { dg-options "-fdump-ipa-inline" } // c++/83667 ICE dumping a static thunk when TARGET_USE_LOCAL_THUNK_ALIAS_P +// { dg-require-effective-target variadic_mi_thunk } struct a diff --git a/gcc/testsuite/g++.dg/torture/pr81812.C b/gcc/testsuite/g++.dg/torture/pr81812.C index b5c621d2beb..80aed8eb2b6 100644 --- a/gcc/testsuite/g++.dg/torture/pr81812.C +++ b/gcc/testsuite/g++.dg/torture/pr81812.C @@ -1,4 +1,5 @@ // { dg-xfail-if "PR108277" { arm_thumb1 } } +// { dg-require-effective-target variadic_mi_thunk } struct Error { virtual void error(... ) const; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C b/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C index 4e684f9367d..e894194db1f 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/thunk3.C @@ -1,5 +1,6 @@ // { dg-do run } -// { dg-skip-if "fails with generic thunk support" { rs6000-*-* powerpc-*-eabi v850-*-* sh-*-* h8*-*-* xtensa*-*-* m32r*-*-* lm32-*-* } } +// { dg-skip-if "fails with generic thunk support" { rs6000-*-* powerpc-*-eabi sh-*-* xtensa*-*-* } } +// { dg-require-effective-target variadic_mi_thunk } // Test that variadic function calls using thunks work right. // Note that this will break on any target that uses the generic thunk // support, because it doesn't support variadic functions. diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 16bb2ae4426..4ccac18accc 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -659,6 +659,37 @@ proc check_effective_target_trampolines { } { return 1 } +# Return 1 if target supports calling variadic methods +# of multi-inheritance classes. + +proc check_effective_target_variadic_mi_thunk { } { + # These targets do not implement TARGET_ASM_OUTPUT_MI_THUNK. + if { [istarget avr-*-*] + || [istarget bpf-*-*] + || [istarget fr30-*-*] + || [istarget ft32-*-*] + || [istarget amdgcn-*-*] + || [istarget h8300-*-*] + || [istarget iq2000-*-*] + || [istarget lm32-*-*] + || [istarget m32c-*-*] + || [istarget m32r-*-*] + || [istarget mcore-*-*] + || [istarget moxie-*-*] + || [istarget msp430-*-*] + || [istarget nvptx-*-*] + || [istarget pdp11-*-*] + || [istarget pru-*-*] + || [istarget rl78-*-*] + || [istarget rx-*-*] + || [istarget v850-*-*] + || [istarget visium-*-*] } { + + return 0; + } + return 1 +} + # Return 1 if target has limited stack size. proc check_effective_target_stack_size { } { -- 2.49.0