diff options
author | Dimitar Dimitrov <dimitar@dinux.eu> | 2025-01-11 18:03:15 +0200 |
---|---|---|
committer | Dimitar Dimitrov <dimitar@dinux.eu> | 2025-04-25 23:07:11 +0300 |
commit | b1cb7a5e273eb3442259981216295d286a7892c7 (patch) | |
tree | db806d9107e4dee9995347ff1be05469047c311f | |
parent | 07b29ef00b7bbe985da62159306361faec2c3a20 (diff) | |
download | gcc-b1cb7a5e273eb3442259981216295d286a7892c7.zip gcc-b1cb7a5e273eb3442259981216295d286a7892c7.tar.gz gcc-b1cb7a5e273eb3442259981216295d286a7892c7.tar.bz2 |
testsuite: Skip tests incompatible with generic thunk support
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.
gcc/ChangeLog:
* doc/sourcebuild.texi: Document variadic_mi_thunk effective
target check.
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 <dimitar@dinux.eu>
-rw-r--r-- | gcc/doc/sourcebuild.texi | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/pr83549.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/pr83667.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr81812.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.jason/thunk3.C | 3 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports.exp | 31 |
6 files changed, 39 insertions, 1 deletions
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 0bd9873..65eeecc 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2957,6 +2957,9 @@ Target supports @code{sysconf}. @item trampolines Target supports trampolines. +@item variadic_mi_thunk +Target supports C++ virtual variadic function calls with multiple inheritance. + @item two_plus_gigs Target supports linking programs with 2+GiB of data. diff --git a/gcc/testsuite/g++.dg/ipa/pr83549.C b/gcc/testsuite/g++.dg/ipa/pr83549.C index 90cf8fe..3b4547b 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 a8a5a5a..ec91a2e 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 b5c621d..80aed8e 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 4e684f9..e894194 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 16bb2ae..287e51b 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 virtual 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 { } { |