Re: [PATCH] testsuite: Skip intrinsics test if arm
On 2023-01-12 16:03, Richard Earnshaw wrote: On 19/09/2022 17:16, Torbjörn SVENSSON via Gcc-patches wrote: In the test case, it's clearly written that intrinsics is not implemented on arm*. A simple xfail does not help since there are link error and that would cause an UNRESOLVED testcase rather than XFAIL. By chaning to dg-skip-if, the entire test case is omitted. gcc/testsuite/ChangeLog: * gcc.target/aarch64/advsimd-intrinsics/vld1x2.c: Replace dg-xfail-if with gd-skip-if. Sorry for the delay reviewing this, I missed it at the time. My problem with your suggested solution is that if these intrinsics are ever added this test will not automatically pick this up as it will have been disabled. I presume from the comment (and the body of the test that contains an #ifdef for aarch64) that this is expected to be a temporary issue rather than something permanent. So IMO I think it is correct to leave this as unresolved because the test cannot be built due to an issue with the compiler. This patch has already been merged after Kyrill reviewed it back in September. Without this change, the log would be filled with warnings about missing types. Maybe we could add some check that will enable the test only if the types are known? Would that mitigate your concern? Attached is the log from vld1x2.c on Cortex-A7 with -mfloat-abi=hard -mfpu=neon. When I look at the result of a run, I only look at the test cases that are either FAIL (obviously), XPASS and UNRESOLVED. All other test cases are in a "good" state from what I can tell. If there are a lot of test cases in the UNRESOLVED state, that are not yet implemented year after year, it makes it harder to identify those test cases that are of interest. Right or wrong, that's why I suggested to remove it for the list of test cases that should be working. Let me know what you think. Kind regards, Torbjörn R. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c index 92a139bc523..f933102be47 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c @@ -1,6 +1,6 @@ /* We haven't implemented these intrinsics for arm yet. */ -/* { dg-xfail-if "" { arm*-*-* } } */ /* { dg-do run } */ +/* { dg-skip-if "unsupported" { arm*-*-* } } */ /* { dg-options "-O3" } */ #include Testing advsimd-intrinsics/vld1x2.c, -O1 doing compile Executing on host: /build/bin/arm-none-eabi-gcc /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c -mthumb -march=armv7ve -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon -dumpbase "" -fdiagnostics-plain-output-O1 -O3 -Wl,gcc_tg.o -lm -T /qemu/qemu-cortex-a7.ld -o ./vld1x2.exe(timeout = 800) spawn -ignore SIGHUP /build/bin/arm-none-eabi-gcc /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c -mthumb -march=armv7ve -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon -dumpbase -fdiagnostics-plain-output -O1 -O3 -Wl,gcc_tg.o -lm -T /qemu/qemu-cortex-a7.ld -o ./vld1x2.exe pid is 22433 -22433 /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c: In function 'test_vld_u8_x2': /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c:21:13: warning: implicit declaration of function 'vld1_u8_x2'; did you mean 'vld1_u32'? [-Wimplicit-function-declaration] /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c:32:1: note: in expansion of macro 'TESTMETH' /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c:62:27: note: in expansion of macro 'VARIANTS_1' /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c:66:1: note: in expansion of macro 'VARIANTS' /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c:21:13: error: incompatible types when assigning to type 'uint8x8x2_t' from type 'int' /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c:32:1: note: in expansion of macro 'TESTMETH' /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c:62:27: note: in expansion of macro 'VARIANTS_1' /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c:66:1: note: in expansion of macro 'VARIANTS' /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c: In function 'test_vld_u16_x2': /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c:21:13: warning: implicit declaration of function 'vld1_u16_x2'; did you mean 'vld1_u16'? [-Wimplicit-function-declaration] /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c:33:1: note: in expansion of macro 'TESTMETH' /src/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1x2.c:62:27: note: in expansion of macro 'VARIANTS_1' /src/gcc/tests
Re: PING [PATCH v3] c++: Allow module name to be a single letter on Windows
On 2022-11-28 12:21, Nathan Sidwell wrote: On 11/25/22 14:03, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606528.html ok, thanks! Pushed. Kind regards, Torbjörn On 2022-11-17 14:20, Torbjörn SVENSSON wrote: v1 -> v2: Paths without "C:" part can still be absolute if they start with / or \ on Windows. v2 -> v3: Use alternative approach by having platform specific code in module.cc. Truth table for the new expression: c:\foo -> true c:/foo -> true /foo -> true \foo -> true c:foo -> false foo -> false ./foo -> true .\foo -> true Ok for trunk? --- On Windows, the ':' character is special and when the module name is a single character, like 'A', then the flatname would be (for example) 'A:Foo'. On Windows, 'A:Foo' is treated as an absolute path by the module loader and is likely not found. Without this patch, the test case pr98944_c.C fails with: In module imported at /src/gcc/testsuite/g++.dg/modules/pr98944_b.C:7:1, of module A:Foo, imported at /src/gcc/testsuite/g++.dg/modules/pr98944_c.C:7: A:Internals: error: header module expected, module 'A:Internals' found A:Internals: error: failed to read compiled module: Bad file data A:Internals: note: compiled module file is 'gcm.cache/A-Internals.gcm' In module imported at /src/gcc/testsuite/g++.dg/modules/pr98944_c.C:7:8: A:Foo: error: failed to read compiled module: Bad import dependency A:Foo: note: compiled module file is 'gcm.cache/A-Foo.gcm' A:Foo: fatal error: returning to the gate for a mechanical issue compilation terminated. gcc/cp/ChangeLog: * module.cc: On Windows, 'A:Foo' is supposed to be a module and not a path. Tested on Windows with arm-none-eabi for Cortex-M3 in gcc-11 tree. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/cp/module.cc | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 0e9af318ba4..fa41a86213f 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -13960,7 +13960,15 @@ get_module (tree name, module_state *parent, bool partition) static module_state * get_module (const char *ptr) { - if (ptr[0] == '.' ? IS_DIR_SEPARATOR (ptr[1]) : IS_ABSOLUTE_PATH (ptr)) + /* On DOS based file systems, there is an ambiguity with A:B which can be + interpreted as a module Module:Partition or Drive:PATH. Interpret strings + which clearly starts as pathnames as header-names and everything else is + treated as a (possibly malformed) named moduled. */ + if (IS_DIR_SEPARATOR (ptr[ptr[0] == '.']) // ./FOO or /FOO +#if HAVE_DOS_BASED_FILE_SYSTEM + || (HAS_DRIVE_SPEC (ptr) && IS_DIR_SEPARATOR (ptr[2])) // A:/FOO +#endif + || false) /* A header name. */ return get_module (build_string (strlen (ptr), ptr));
PING [PATCH v3] c++: Allow module name to be a single letter on Windows
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606528.html Kind regards, Torbjörn On 2022-11-17 14:20, Torbjörn SVENSSON wrote: v1 -> v2: Paths without "C:" part can still be absolute if they start with / or \ on Windows. v2 -> v3: Use alternative approach by having platform specific code in module.cc. Truth table for the new expression: c:\foo -> true c:/foo -> true /foo -> true \foo -> true c:foo -> false foo-> false ./foo -> true .\foo -> true Ok for trunk? --- On Windows, the ':' character is special and when the module name is a single character, like 'A', then the flatname would be (for example) 'A:Foo'. On Windows, 'A:Foo' is treated as an absolute path by the module loader and is likely not found. Without this patch, the test case pr98944_c.C fails with: In module imported at /src/gcc/testsuite/g++.dg/modules/pr98944_b.C:7:1, of module A:Foo, imported at /src/gcc/testsuite/g++.dg/modules/pr98944_c.C:7: A:Internals: error: header module expected, module 'A:Internals' found A:Internals: error: failed to read compiled module: Bad file data A:Internals: note: compiled module file is 'gcm.cache/A-Internals.gcm' In module imported at /src/gcc/testsuite/g++.dg/modules/pr98944_c.C:7:8: A:Foo: error: failed to read compiled module: Bad import dependency A:Foo: note: compiled module file is 'gcm.cache/A-Foo.gcm' A:Foo: fatal error: returning to the gate for a mechanical issue compilation terminated. gcc/cp/ChangeLog: * module.cc: On Windows, 'A:Foo' is supposed to be a module and not a path. Tested on Windows with arm-none-eabi for Cortex-M3 in gcc-11 tree. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/cp/module.cc | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 0e9af318ba4..fa41a86213f 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -13960,7 +13960,15 @@ get_module (tree name, module_state *parent, bool partition) static module_state * get_module (const char *ptr) { - if (ptr[0] == '.' ? IS_DIR_SEPARATOR (ptr[1]) : IS_ABSOLUTE_PATH (ptr)) + /* On DOS based file systems, there is an ambiguity with A:B which can be + interpreted as a module Module:Partition or Drive:PATH. Interpret strings + which clearly starts as pathnames as header-names and everything else is + treated as a (possibly malformed) named moduled. */ + if (IS_DIR_SEPARATOR (ptr[ptr[0] == '.']) // ./FOO or /FOO +#if HAVE_DOS_BASED_FILE_SYSTEM + || (HAS_DRIVE_SPEC (ptr) && IS_DIR_SEPARATOR (ptr[2])) // A:/FOO +#endif + || false) /* A header name. */ return get_module (build_string (strlen (ptr), ptr));
Re: PING^2 [PATCH] testsuite: Windows paths use \ and not /
Pushed after off-list approval from Jeff Law. On 2022-11-17 17:44, Torbjorn SVENSSON via Gcc-patches wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-November/604896.html Ok for trunk? Kind regards, Torbjörn On 2022-11-02 19:16, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604312.html Ok for trunk? Kind regards, Torbjörn On 2022-10-25 17:15, Torbjörn SVENSSON wrote: Without this patch, the following error is reported on Windows: In file included from t:\build\arm-none-eabi\include\c++\11.3.1\string:54, from t:\build\arm-none-eabi\include\c++\11.3.1\bits\locale_classes.h:40, from t:\build\arm-none-eabi\include\c++\11.3.1\bits\ios_base.h:41, from t:\build\arm-none-eabi\include\c++\11.3.1\ios:42, from t:\build\arm-none-eabi\include\c++\11.3.1\ostream:38, from t:\build\arm-none-eabi\include\c++\11.3.1\iostream:39: t:\build\arm-none-eabi\include\c++\11.3.1\bits\range_access.h:36:10: note: include 't:\build\arm-none-eabi\include\c++\11.3.1\initializer_list' translated to import arm-none-eabi-g++.exe: warning: .../gcc/testsuite/g++.dg/modules/pr99023_b.X: linker input file unused because linking not done FAIL: g++.dg/modules/pr99023_b.X -std=c++2a dg-regexp 6 not found: "[^\n]*: note: include '[^\n]*/initializer_list' translated to import\n" gcc/testsuite/ChangeLog: * g++.dg/modules/pr99023_b.X: Match Windows paths too. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/g++.dg/modules/pr99023_b.X | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/g++.dg/modules/pr99023_b.X b/gcc/testsuite/g++.dg/modules/pr99023_b.X index 3d82f34868b..ca5f32e5bcc 100644 --- a/gcc/testsuite/g++.dg/modules/pr99023_b.X +++ b/gcc/testsuite/g++.dg/modules/pr99023_b.X @@ -3,5 +3,5 @@ // { dg-prune-output {linker input file unused} } -// { dg-regexp {[^\n]*: note: include '[^\n]*/initializer_list' translated to import\n} } +// { dg-regexp {[^\n]*: note: include '[^\n]*[/\\]initializer_list' translated to import\n} } NO DO NOT COMPILE
Re: PING^1 [PATCH] cpp/remap: Only override if string matched
Hi, On 2022-11-20 21:31, Jeff Law wrote: On 11/2/22 12:21, Torbjorn SVENSSON via Gcc-patches wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604062.html Ok for trunk? OK. Sorry for the delay. Thanks for the review. Pushed. Kind regards, Torbjörn jeff
Re: PING^5 [PATCH] testsuite: Verify that module-mapper is available
On 2022-11-18 09:14, Richard Biener wrote: On Thu, Nov 17, 2022 at 6:09 PM Torbjorn SVENSSON via Gcc-patches wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-November/604895.html Ok for trunk? OK. Pushed. Kind regards, Torbjörn On 2022-11-02 19:13, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602844.html Ok for trunk? Kind regards, Torbjörn On 2022-10-25 16:24, Torbjorn SVENSSON via Gcc-patches wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603544.html Kind regards, Torbjörn On 2022-10-14 09:42, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602843.html Kind regards, Torbjörn On 2022-10-05 11:17, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602111.html Kind regards, Torbjörn On 2022-09-23 14:03, Torbjörn SVENSSON wrote: For some test cases, it's required that the optional module mapper "g++-mapper-server" is built. As the server is not required, the test cases will fail if it can't be found. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_is_prog_name_available): New. * lib/target-supports-dg.exp (dg-require-prog-name-available): New. * g++.dg/modules/modules.exp: Verify avilability of module mapper. Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/g++.dg/modules/modules.exp | 31 gcc/testsuite/lib/target-supports-dg.exp | 15 gcc/testsuite/lib/target-supports.exp| 15 3 files changed, 61 insertions(+) diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp index afb323d0efd..4784803742a 100644 --- a/gcc/testsuite/g++.dg/modules/modules.exp +++ b/gcc/testsuite/g++.dg/modules/modules.exp @@ -279,6 +279,29 @@ proc module-init { src } { return $option_list } +# Return 1 if requirements are met +proc module-check-requirements { tests } { +foreach test $tests { +set tmp [dg-get-options $test] +foreach op $tmp { +switch [lindex $op 0] { +"dg-additional-options" { +# Example strings to match: +# -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\ -t\\ [srcdir]/inc-xlate-1.map +# -fmodules-ts -fmodule-mapper=|@g++-mapper-server +if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)} [lindex $op 2] dummy dummy2 prog] { +verbose "Checking that mapper exist: $prog" +if { ![ check_is_prog_name_available $prog ] } { +return 0 +} +} +} +} +} +} +return 1 +} + # cleanup any detritus from previous run cleanup_module_files [find $DEFAULT_REPO *.gcm] @@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] { set tests [lsort [find [file dirname $src] \ [regsub {_a.[CHX]$} [file tail $src] {_[a-z].[CHX]}]]] +if { ![module-check-requirements $tests] } { +set testcase [regsub {_a.[CH]} $src {}] +set testcase \ +[string range $testcase [string length "$srcdir/"] end] +unsupported $testcase +continue +} + set std_list [module-init $src] foreach std $std_list { set mod_files {} diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index aa2164bc789..6ce3b2b1a1b 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -683,3 +683,18 @@ proc dg-require-symver { args } { set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] } } + +# If this target does not provide prog named "$args", skip this test. + +proc dg-require-prog-name-available { args } { +# The args are within another list; pull them out. +set args [lindex $args 0] + +set prog [lindex $args 1] + +if { ![ check_is_prog_name_available $prog ] } { +upvar dg-do-what dg-do-what +set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] +} +} + diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 703aba412a6..c3b7a6c17b3 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -11928,3 +11928,18 @@ main: .byte 0 } ""] } + +# Return 1 if this target has prog named "$prog", 0 otherwise. + +proc check_is_prog_name_available { prog } { +global tool + +set options [list "additional_flags=-print-prog-name=$prog"] +set output [lindex [${tool}_target_compile "" "" "none" $options] 0] + +if { $output == $prog } { +return 0 +} + +return 1 +}
PING^5 [PATCH] testsuite: Verify that module-mapper is available
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-November/604895.html Ok for trunk? Kind regards, Torbjörn On 2022-11-02 19:13, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602844.html Ok for trunk? Kind regards, Torbjörn On 2022-10-25 16:24, Torbjorn SVENSSON via Gcc-patches wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603544.html Kind regards, Torbjörn On 2022-10-14 09:42, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602843.html Kind regards, Torbjörn On 2022-10-05 11:17, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602111.html Kind regards, Torbjörn On 2022-09-23 14:03, Torbjörn SVENSSON wrote: For some test cases, it's required that the optional module mapper "g++-mapper-server" is built. As the server is not required, the test cases will fail if it can't be found. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_is_prog_name_available): New. * lib/target-supports-dg.exp (dg-require-prog-name-available): New. * g++.dg/modules/modules.exp: Verify avilability of module mapper. Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/g++.dg/modules/modules.exp | 31 gcc/testsuite/lib/target-supports-dg.exp | 15 gcc/testsuite/lib/target-supports.exp | 15 3 files changed, 61 insertions(+) diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp index afb323d0efd..4784803742a 100644 --- a/gcc/testsuite/g++.dg/modules/modules.exp +++ b/gcc/testsuite/g++.dg/modules/modules.exp @@ -279,6 +279,29 @@ proc module-init { src } { return $option_list } +# Return 1 if requirements are met +proc module-check-requirements { tests } { + foreach test $tests { + set tmp [dg-get-options $test] + foreach op $tmp { + switch [lindex $op 0] { + "dg-additional-options" { + # Example strings to match: + # -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\ -t\\ [srcdir]/inc-xlate-1.map + # -fmodules-ts -fmodule-mapper=|@g++-mapper-server + if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)} [lindex $op 2] dummy dummy2 prog] { + verbose "Checking that mapper exist: $prog" + if { ![ check_is_prog_name_available $prog ] } { + return 0 + } + } + } + } + } + } + return 1 +} + # cleanup any detritus from previous run cleanup_module_files [find $DEFAULT_REPO *.gcm] @@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] { set tests [lsort [find [file dirname $src] \ [regsub {_a.[CHX]$} [file tail $src] {_[a-z].[CHX]}]]] + if { ![module-check-requirements $tests] } { + set testcase [regsub {_a.[CH]} $src {}] + set testcase \ + [string range $testcase [string length "$srcdir/"] end] + unsupported $testcase + continue + } + set std_list [module-init $src] foreach std $std_list { set mod_files {} diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index aa2164bc789..6ce3b2b1a1b 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -683,3 +683,18 @@ proc dg-require-symver { args } { set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] } } + +# If this target does not provide prog named "$args", skip this test. + +proc dg-require-prog-name-available { args } { + # The args are within another list; pull them out. + set args [lindex $args 0] + + set prog [lindex $args 1] + + if { ![ check_is_prog_name_available $prog ] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } +} + diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 703aba412a6..c3b7a6c17b3 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -11928,3 +11928,18 @@ main: .byte 0 } ""] } + +# Return 1 if this target has prog named "$prog", 0 otherwise. + +proc check_is_prog_name_available { prog } { + global tool + + set options [list "additional_flags=-print-prog-name=$prog"] + set output [lindex [${tool}_target_compile "" "" "none" $options] 0] + + if { $output == $prog } { + return 0 + } + + return 1 +}
PING^2 [PATCH] cpp/remap: Only override if string matched
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-November/604898.html Ok for trunk? Kind regards, Torbjörn On 2022-11-02 19:21, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604062.html Ok for trunk? Kind regards, Torbjörn On 2022-10-20 22:48, Torbjörn SVENSSON wrote: For systems with HAVE_DOS_BASED_FILE_SYSTEM set, only override the pointer if the backslash pattern matches. Output without this patch: .../gcc/testsuite/gcc.dg/cpp/pr71681-2.c:5:10: fatal error: a/t2.h: No such file or directory With patch applied, no output and the test case succeeds. libcpp/ChangeLog * files.cc: Ensure pattern matches before use. Signed-off-by: Torbjörn SVENSSON --- libcpp/files.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcpp/files.cc b/libcpp/files.cc index 24208f7b0f8..a18b1caf48d 100644 --- a/libcpp/files.cc +++ b/libcpp/files.cc @@ -1833,7 +1833,7 @@ remap_filename (cpp_reader *pfile, _cpp_file *file) #ifdef HAVE_DOS_BASED_FILE_SYSTEM { const char *p2 = strchr (fname, '\\'); - if (!p || (p > p2)) + if (!p || (p2 && p > p2)) p = p2; } #endif
PING^2 [PATCH] testsuite: Windows paths use \ and not /
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-November/604896.html Ok for trunk? Kind regards, Torbjörn On 2022-11-02 19:16, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604312.html Ok for trunk? Kind regards, Torbjörn On 2022-10-25 17:15, Torbjörn SVENSSON wrote: Without this patch, the following error is reported on Windows: In file included from t:\build\arm-none-eabi\include\c++\11.3.1\string:54, from t:\build\arm-none-eabi\include\c++\11.3.1\bits\locale_classes.h:40, from t:\build\arm-none-eabi\include\c++\11.3.1\bits\ios_base.h:41, from t:\build\arm-none-eabi\include\c++\11.3.1\ios:42, from t:\build\arm-none-eabi\include\c++\11.3.1\ostream:38, from t:\build\arm-none-eabi\include\c++\11.3.1\iostream:39: t:\build\arm-none-eabi\include\c++\11.3.1\bits\range_access.h:36:10: note: include 't:\build\arm-none-eabi\include\c++\11.3.1\initializer_list' translated to import arm-none-eabi-g++.exe: warning: .../gcc/testsuite/g++.dg/modules/pr99023_b.X: linker input file unused because linking not done FAIL: g++.dg/modules/pr99023_b.X -std=c++2a dg-regexp 6 not found: "[^\n]*: note: include '[^\n]*/initializer_list' translated to import\n" gcc/testsuite/ChangeLog: * g++.dg/modules/pr99023_b.X: Match Windows paths too. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/g++.dg/modules/pr99023_b.X | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/g++.dg/modules/pr99023_b.X b/gcc/testsuite/g++.dg/modules/pr99023_b.X index 3d82f34868b..ca5f32e5bcc 100644 --- a/gcc/testsuite/g++.dg/modules/pr99023_b.X +++ b/gcc/testsuite/g++.dg/modules/pr99023_b.X @@ -3,5 +3,5 @@ // { dg-prune-output {linker input file unused} } -// { dg-regexp {[^\n]*: note: include '[^\n]*/initializer_list' translated to import\n} } +// { dg-regexp {[^\n]*: note: include '[^\n]*[/\\]initializer_list' translated to import\n} } NO DO NOT COMPILE
Re: [PATCH] testsuite: Fix mistransformed gcov
Hi, On 2022-11-16 03:11, Hans-Peter Nilsson wrote: How was r13-2619-g34b9a03353d3fd "gcov: Respect triplet when looking for gcov" tested? I'm having a hard time believing it was tested with a *cross-compiler* *in-build-tree*. I think it was only tested for the special-case of an installed cross-compiler; not even with a native build exercising the false branch (see patch), considering that a breaking typo ("}" vs "]") snuck by in the first revision, before commit. I was testing this in out-of-tree test with a cross-compiler (built for arm-none-eabi) running on Windows and Linux and just noticed the failure and (wrongly) assumed that all of the cases needed the transformation call as that's how other tools were handled. The test systems used is are hosts that does not have any internet connection, so that's why I got a typo in the first patch when moving the fix to a system that did have an internet connection. Sorry for the mess I caused! Regarding the patch you propose; it looks good to me, but I'm not able to approve it. Kind regards, Torbjörn I guess reviewers forgot to ask that, but it's really on the submitter; it's a general requirement for patches to say how it was tested. Usually no more is needed than "tested with a cross-compiler for ..., no regressions" (implying running twice and comparing results before and after the patch). In this case, when adjusting test-framework bits, a little more care and mentioned details about how it was tested, would have been in order. It's likely it'd have shown that an uninstalled in-tree cross (an IMHO more expected case) wasn't tested, which that patch broke for the one gcov invocation that the testsuite does for cross-builds (IIUC). It can be said like this: I tested *this* patch as follows (all directory names below manually redacted), showing no regressions and fixing the regression for the in-tree cross build; For a native build (x86_64, Debian 11): - In the gcc build directory: make check RUNTESTFLAGS=gcov.exp - In an empty new directory after native installation in /pre. /gccsrc/top/contrib/test_installed --prefix=/pre gcov.exp - Also, for good measure (mentioned somewhere in the installation documentation) native: for tool in gcc g++ ; do env PATH=/pre/bin:$PATH runtest \ --tool $tool --srcdir=/gccsrc/top/gcc/testsuite gcov.exp; done For a cris-elf cross: - In the gcc build directory: make check 'RUNTESTFLAGS=--target_board=cris-sim gcov.exp' - In an empty new directory after installation in /pre. /gccsrc/top/contrib/test_installed --with-gcc=/pre/bin/cris-elf-gcc \ --with-g++=/pre/bin/cris-elf-g++ --with-gfortran=/pre/bin/cris-elf-gfortran \ --target=cris-elf --target_board=cris-sim gcov.exp Ok to commit? brgds, H-P PS. Beware that the proc name may be up for bikeshedding. 8< 8< 8< 8< In commit r13-2619-g34b9a03353d3fd, [transform] was applied to all invocations of gcov, for both out-of-tree and in-tree testing. For in-tree cross builds, this means gcov was called as "/path/to/gccobj/gcc/target-tuple-gcov" gcov-pr94029.c which is incorrect, as it's there "/path/to/gccobj/gcc/gcov" until it's installed. This caused a testsuite failure, like: Running /x/gcc/gcc/testsuite/gcc.misc-tests/gcov.exp ... FAIL: gcc.misc-tests/gcov-pr94029.c gcov failed: spawn failed To avoid cumbersome conditionals, use a dedicated new helper function. gcc/testsuite: * lib/gcc-dg.exp (gcc-transform-out-of-tree): New proc. * g++.dg/gcov/gcov.exp, gcc.misc-tests/gcov.exp: Call gcc-transform-out-of-tree instead of transform. --- gcc/testsuite/g++.dg/gcov/gcov.exp| 4 ++-- gcc/testsuite/gcc.misc-tests/gcov.exp | 4 ++-- gcc/testsuite/lib/gcc-dg.exp | 13 + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/g++.dg/gcov/gcov.exp b/gcc/testsuite/g++.dg/gcov/gcov.exp index 04e7a0164865..c9f20958836b 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov.exp +++ b/gcc/testsuite/g++.dg/gcov/gcov.exp @@ -24,9 +24,9 @@ global GXX_UNDER_TEST # Find gcov in the same directory as $GXX_UNDER_TEST. if { ![is_remote host] && [string match "*/*" [lindex $GXX_UNDER_TEST 0]] } { -set GCOV [file dirname [lindex $GXX_UNDER_TEST 0]]/[transform gcov] +set GCOV [file dirname [lindex $GXX_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] } else { -set GCOV [transform gcov] +set GCOV [gcc-transform-out-of-tree gcov] } # Initialize harness. diff --git a/gcc/testsuite/gcc.misc-tests/gcov.exp b/gcc/testsuite/gcc.misc-tests/gcov.exp index b8e9661aa537..90ceec46e0f0 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov.exp +++ b/gcc/testsuite/gcc.misc-tests/gcov.exp @@ -24,9 +24,9 @@ global GCC_UNDER_TEST # For now find gcov in the same directory as $GCC_UNDER_TEST. if { ![is_remote host] && [string match "*/*" [lindex $GCC_UNDER_TEST 0]] } { -set GCOV [file dirname [lindex $GCC_UNDER_TEST 0]]/[transform gcov] +set GC
Re: [PATCH] c++: Allow module name to be a single letter on Windows
Hi Nathan, On 2022-11-08 00:03, Nathan Sidwell wrote: On 11/3/22 11:06, Torbjorn SVENSSON wrote: On 2022-11-03 15:17, Nathan Sidwell wrote: On 10/28/22 05:15, Torbjörn SVENSSON wrote: On Windows, the ':' character is special and when the module name is a single character, like 'A', then the flatname would be (for example) 'A:Foo'. On Windows, 'A:Foo' is treated as an absolute path by the module loader and is likely not found. Without this patch, the test case pr98944_c.C fails with: In module imported at /src/gcc/testsuite/g++.dg/modules/pr98944_b.C:7:1, of module A:Foo, imported at /src/gcc/testsuite/g++.dg/modules/pr98944_c.C:7: A:Internals: error: header module expected, module 'A:Internals' found A:Internals: error: failed to read compiled module: Bad file data A:Internals: note: compiled module file is 'gcm.cache/A-Internals.gcm' In module imported at /src/gcc/testsuite/g++.dg/modules/pr98944_c.C:7:8: A:Foo: error: failed to read compiled module: Bad import dependency A:Foo: note: compiled module file is 'gcm.cache/A-Foo.gcm' A:Foo: fatal error: returning to the gate for a mechanical issue compilation terminated. include/ChangeLog: * filenames.h: Added IS_REAL_ABSOLUTE_PATH macro to check if path is absolute and not semi-absolute on Windows. Hm, this is unfortunate. The current IS_ABSOLUTE_PATH, is really 'not relative to cwd', and even then that's untrue if the drive letter there is the drive letter of cwd, right? It's awkward to have a new macro for just this purpose and the new name isn't very indicative of the difference to the current IS_ABSOLUTE_PATH. Would it be better to not deal with drive letters here? How prevalent are they these days in windows? Would something like if (IS_DIR_SEPARATOR (ptr[ptr[0] == '.']) suffice? I don't think you can ignore the drive letter part... see below. #include #include "include/filenames.h" #define TF(x) ((x) ? "true" : "false") int main(int argc, char *argv[]) { const char *test[] = { /* absolute */ "c:\\foo", "c:/foo", "/foo", "\\foo", /* semi-absolute */ "c:foo", /* relative */ "foo", "./foo", ".\\foo", }; for (int i = 0; i < sizeof(test) / sizeof(test[0]); i++) { const char *ptr = test[i]; printf("\nptr: %s\n", ptr); printf(" IS_DOS_ABSOLUTE_PATH: %s\n", TF(IS_DOS_ABSOLUTE_PATH(ptr))); printf(" IS_DOS_REAL_ABSOLUTE_PATH: %s\n", TF(IS_DOS_REAL_ABSOLUTE_PATH(ptr))); printf(" IS_DIR_SEPARATOR: %s\n", TF(IS_DIR_SEPARATOR(ptr[ptr[0] == '.']))); } return 0; } The output is: ptr: c:\foo IS_DOS_ABSOLUTE_PATH: true IS_DOS_REAL_ABSOLUTE_PATH: true IS_DIR_SEPARATOR: false ptr: c:/foo IS_DOS_ABSOLUTE_PATH: true IS_DOS_REAL_ABSOLUTE_PATH: true IS_DIR_SEPARATOR: false ptr: /foo IS_DOS_ABSOLUTE_PATH: true IS_DOS_REAL_ABSOLUTE_PATH: true IS_DIR_SEPARATOR: true ptr: \foo IS_DOS_ABSOLUTE_PATH: true IS_DOS_REAL_ABSOLUTE_PATH: true IS_DIR_SEPARATOR: false ptr: c:foo IS_DOS_ABSOLUTE_PATH: true IS_DOS_REAL_ABSOLUTE_PATH: false IS_DIR_SEPARATOR: false ptr: foo IS_DOS_ABSOLUTE_PATH: false IS_DOS_REAL_ABSOLUTE_PATH: false IS_DIR_SEPARATOR: false ptr: ./foo IS_DOS_ABSOLUTE_PATH: false IS_DOS_REAL_ABSOLUTE_PATH: false IS_DIR_SEPARATOR: true ptr: .\foo IS_DOS_ABSOLUTE_PATH: false IS_DOS_REAL_ABSOLUTE_PATH: false IS_DIR_SEPARATOR: false or, failing that perhaps put some explicit WINDOWS-specific #ifdef'd code there? It's a real corner case. Would you rather have something like this in module.cc? if (ptr[0] == '.') { if IS_DIR_SEPARATOR (ptr[1])) return get_module (build_string (strlen (ptr), ptr)); } else { #if HAVE_DOS_BASED_FILE_SYSTEM if (HAS_DRIVE_SPEC (ptr) && IS_DIR_SEPARATOR (ptr[2])) #else if (IS_ABSOLUTE_PATH (ptr)) #endif return get_module (build_string (strlen (ptr), ptr)); } Yes, something like the above, but I think you're missing "/bob' in the DOS_BASED case? shouldn't that also be a pathname? if (IS_DIR_SEPARATOR (ptr[ptr[0] == '.']) // ./FOO or /FOO #if HAVE_DOS_BASED_FILE_SYSTEM // DOS-FS IS_ABSOLUTE_PATH thinks 'A:B' is absolute, but we need to consider // that as a module:partition. || (HAS_DRIVE_SPEC (ptr) && IS_DIR_SEPARATOR (ptr[2])) // A:/FOO #endif || false) return Does (something like) that work? I tested it and your solution appears to work. Are you okay with me pushing that solution or do you want me to send a v2 with it first? Kind regards, Torbjörn nathan Let me know what you prefer. Kind regards, Torbjörn nathan gcc/cp/ChangeLog: * module.cc: Use IS_REAL_ABSOLUTE_PATH macro. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/cp/module.cc | 2 +- include/filenames.h | 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 9957d
Re: PING^1 [PATCH] arm: Allow to override location of .gnu.sgstubs section
On 2022-11-03 10:44, Kyrylo Tkachov wrote: -Original Message- From: Torbjorn SVENSSON Sent: Wednesday, November 2, 2022 6:19 PM To: gcc-patches@gcc.gnu.org Cc: Kyrylo Tkachov Subject: PING^1 [PATCH] arm: Allow to override location of .gnu.sgstubs section Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603878.html Ok, thanks for pinging it. Kyrill Pushed.
Re: [PATCH v2] c++: Use in-process client when networking is disabled
On 2022-11-03 15:09, Nathan Sidwell wrote: On 11/3/22 09:48, Torbjorn SVENSSON wrote: Hello Nathan, On 2022-11-03 14:13, Nathan Sidwell wrote: On 11/3/22 05:37, Torbjörn SVENSSON wrote: v1 -> v2: Updated expression in bad-mapper-3.C Ok for trunk? --- Without the patch, the output for bad-mapper-3.C would be: /src/gcc/gcc/testsuite/g++.dg/modules/bad-mapper-3.C:2:1: error: unknown Compiled Module Interface: no such module As this line is unexpected, the test case would fail. The same problem can also be seen for g++.dg/modules/bad-mapper-2.C. gcc/cp/ChangeLog: * mapper-client.cc: Use in-process client when networking is disabled. gcc/testsuite/ChangeLog: * g++.dg/modules/bad-mapper-3.C: Update dg-error pattern. Tested on Windows with arm-none-eabi for Cortex-M3 in gcc-11 tree. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/cp/mapper-client.cc | 4 gcc/testsuite/g++.dg/modules/bad-mapper-3.C | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/cp/mapper-client.cc b/gcc/cp/mapper-client.cc index fe9544b5ba4..4dcb3a03660 100644 --- a/gcc/cp/mapper-client.cc +++ b/gcc/cp/mapper-client.cc @@ -227,6 +227,8 @@ module_client::open_module_client (location_t loc, const char *o, int fd = -1; #if CODY_NETWORKING fd = Cody::OpenLocal (&errmsg, name.c_str () + 1); +#else + errmsg = "CODY_NETWORKING disabled"; CODY_NETWORKING is implementor speak. I think just "disabled" is sufficient here? Ok for trunk if I change to just "disabled" here and in the other places below? yes, thanks Kind regards, Torbjörn #endif if (fd >= 0) c = new module_client (fd, fd); @@ -254,6 +256,8 @@ module_client::open_module_client (location_t loc, const char *o, int fd = -1; #if CODY_NETWORKING fd = Cody::OpenInet6 (&errmsg, name.c_str (), port); +#else + errmsg = "CODY_NETWORKING disabled"; #endif name[colon] = ':'; diff --git a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C index 9dab332ccb2..c91bb4e260c 100644 --- a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C +++ b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C @@ -1,6 +1,6 @@ // { dg-additional-options "-fmodules-ts -fmodule-mapper=localhost:172477262" } import unique3.bob; -// { dg-error {failed connecting mapper 'localhost:172477262'} "" { target *-*-* } 0 } +// { dg-error {failed (connecting|CODY_NETWORKING disabled) mapper 'localhost:172477262'} "" { target *-*-* } 0 } // { dg-prune-output "fatal error:" } // { dg-prune-output "failed to read" } // { dg-prune-output "compilation terminated" } Pushed.
Re: [PATCH] c++: Allow module name to be a single letter on Windows
On 2022-11-03 15:17, Nathan Sidwell wrote: On 10/28/22 05:15, Torbjörn SVENSSON wrote: On Windows, the ':' character is special and when the module name is a single character, like 'A', then the flatname would be (for example) 'A:Foo'. On Windows, 'A:Foo' is treated as an absolute path by the module loader and is likely not found. Without this patch, the test case pr98944_c.C fails with: In module imported at /src/gcc/testsuite/g++.dg/modules/pr98944_b.C:7:1, of module A:Foo, imported at /src/gcc/testsuite/g++.dg/modules/pr98944_c.C:7: A:Internals: error: header module expected, module 'A:Internals' found A:Internals: error: failed to read compiled module: Bad file data A:Internals: note: compiled module file is 'gcm.cache/A-Internals.gcm' In module imported at /src/gcc/testsuite/g++.dg/modules/pr98944_c.C:7:8: A:Foo: error: failed to read compiled module: Bad import dependency A:Foo: note: compiled module file is 'gcm.cache/A-Foo.gcm' A:Foo: fatal error: returning to the gate for a mechanical issue compilation terminated. include/ChangeLog: * filenames.h: Added IS_REAL_ABSOLUTE_PATH macro to check if path is absolute and not semi-absolute on Windows. Hm, this is unfortunate. The current IS_ABSOLUTE_PATH, is really 'not relative to cwd', and even then that's untrue if the drive letter there is the drive letter of cwd, right? It's awkward to have a new macro for just this purpose and the new name isn't very indicative of the difference to the current IS_ABSOLUTE_PATH. Would it be better to not deal with drive letters here? How prevalent are they these days in windows? Would something like if (IS_DIR_SEPARATOR (ptr[ptr[0] == '.']) suffice? I don't think you can ignore the drive letter part... see below. #include #include "include/filenames.h" #define TF(x) ((x) ? "true" : "false") int main(int argc, char *argv[]) { const char *test[] = { /* absolute */ "c:\\foo", "c:/foo", "/foo", "\\foo", /* semi-absolute */ "c:foo", /* relative */ "foo", "./foo", ".\\foo", }; for (int i = 0; i < sizeof(test) / sizeof(test[0]); i++) { const char *ptr = test[i]; printf("\nptr: %s\n", ptr); printf(" IS_DOS_ABSOLUTE_PATH: %s\n", TF(IS_DOS_ABSOLUTE_PATH(ptr))); printf(" IS_DOS_REAL_ABSOLUTE_PATH: %s\n", TF(IS_DOS_REAL_ABSOLUTE_PATH(ptr))); printf(" IS_DIR_SEPARATOR: %s\n", TF(IS_DIR_SEPARATOR(ptr[ptr[0] == '.']))); } return 0; } The output is: ptr: c:\foo IS_DOS_ABSOLUTE_PATH: true IS_DOS_REAL_ABSOLUTE_PATH: true IS_DIR_SEPARATOR: false ptr: c:/foo IS_DOS_ABSOLUTE_PATH: true IS_DOS_REAL_ABSOLUTE_PATH: true IS_DIR_SEPARATOR: false ptr: /foo IS_DOS_ABSOLUTE_PATH: true IS_DOS_REAL_ABSOLUTE_PATH: true IS_DIR_SEPARATOR: true ptr: \foo IS_DOS_ABSOLUTE_PATH: true IS_DOS_REAL_ABSOLUTE_PATH: true IS_DIR_SEPARATOR: false ptr: c:foo IS_DOS_ABSOLUTE_PATH: true IS_DOS_REAL_ABSOLUTE_PATH: false IS_DIR_SEPARATOR: false ptr: foo IS_DOS_ABSOLUTE_PATH: false IS_DOS_REAL_ABSOLUTE_PATH: false IS_DIR_SEPARATOR: false ptr: ./foo IS_DOS_ABSOLUTE_PATH: false IS_DOS_REAL_ABSOLUTE_PATH: false IS_DIR_SEPARATOR: true ptr: .\foo IS_DOS_ABSOLUTE_PATH: false IS_DOS_REAL_ABSOLUTE_PATH: false IS_DIR_SEPARATOR: false or, failing that perhaps put some explicit WINDOWS-specific #ifdef'd code there? It's a real corner case. Would you rather have something like this in module.cc? if (ptr[0] == '.') { if IS_DIR_SEPARATOR (ptr[1])) return get_module (build_string (strlen (ptr), ptr)); } else { #if HAVE_DOS_BASED_FILE_SYSTEM if (HAS_DRIVE_SPEC (ptr) && IS_DIR_SEPARATOR (ptr[2])) #else if (IS_ABSOLUTE_PATH (ptr)) #endif return get_module (build_string (strlen (ptr), ptr)); } Let me know what you prefer. Kind regards, Torbjörn nathan gcc/cp/ChangeLog: * module.cc: Use IS_REAL_ABSOLUTE_PATH macro. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/cp/module.cc | 2 +- include/filenames.h | 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 9957df510e6..84680e183b7 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -13958,7 +13958,7 @@ get_module (tree name, module_state *parent, bool partition) static module_state * get_module (const char *ptr) { - if (ptr[0] == '.' ? IS_DIR_SEPARATOR (ptr[1]) : IS_ABSOLUTE_PATH (ptr)) + if (ptr[0] == '.' ? IS_DIR_SEPARATOR (ptr[1]) : IS_REAL_ABSOLUTE_PATH (ptr)) /* A header name. */ return get_module (build_string (strlen (ptr), ptr)); diff --git a/include/filenames.h b/include/filenames.h index 6c72c422edd..d04fccfed64 100644 --- a/include/filenames.h +++ b/include/filenames.h @@ -43,6 +43,7 @@ extern "C" { # define HAS_DRIVE_SPEC(f) HAS_DOS_DRIVE_SPEC (f) # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c) # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f) +
Re: [PATCH v2] c++: Use in-process client when networking is disabled
Hello Nathan, On 2022-11-03 14:13, Nathan Sidwell wrote: On 11/3/22 05:37, Torbjörn SVENSSON wrote: v1 -> v2: Updated expression in bad-mapper-3.C Ok for trunk? --- Without the patch, the output for bad-mapper-3.C would be: /src/gcc/gcc/testsuite/g++.dg/modules/bad-mapper-3.C:2:1: error: unknown Compiled Module Interface: no such module As this line is unexpected, the test case would fail. The same problem can also be seen for g++.dg/modules/bad-mapper-2.C. gcc/cp/ChangeLog: * mapper-client.cc: Use in-process client when networking is disabled. gcc/testsuite/ChangeLog: * g++.dg/modules/bad-mapper-3.C: Update dg-error pattern. Tested on Windows with arm-none-eabi for Cortex-M3 in gcc-11 tree. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/cp/mapper-client.cc | 4 gcc/testsuite/g++.dg/modules/bad-mapper-3.C | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/cp/mapper-client.cc b/gcc/cp/mapper-client.cc index fe9544b5ba4..4dcb3a03660 100644 --- a/gcc/cp/mapper-client.cc +++ b/gcc/cp/mapper-client.cc @@ -227,6 +227,8 @@ module_client::open_module_client (location_t loc, const char *o, int fd = -1; #if CODY_NETWORKING fd = Cody::OpenLocal (&errmsg, name.c_str () + 1); +#else + errmsg = "CODY_NETWORKING disabled"; CODY_NETWORKING is implementor speak. I think just "disabled" is sufficient here? Ok for trunk if I change to just "disabled" here and in the other places below? Kind regards, Torbjörn #endif if (fd >= 0) c = new module_client (fd, fd); @@ -254,6 +256,8 @@ module_client::open_module_client (location_t loc, const char *o, int fd = -1; #if CODY_NETWORKING fd = Cody::OpenInet6 (&errmsg, name.c_str (), port); +#else + errmsg = "CODY_NETWORKING disabled"; #endif name[colon] = ':'; diff --git a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C index 9dab332ccb2..c91bb4e260c 100644 --- a/gcc/testsuite/g++.dg/modules/bad-mapper-3.C +++ b/gcc/testsuite/g++.dg/modules/bad-mapper-3.C @@ -1,6 +1,6 @@ // { dg-additional-options "-fmodules-ts -fmodule-mapper=localhost:172477262" } import unique3.bob; -// { dg-error {failed connecting mapper 'localhost:172477262'} "" { target *-*-* } 0 } +// { dg-error {failed (connecting|CODY_NETWORKING disabled) mapper 'localhost:172477262'} "" { target *-*-* } 0 } // { dg-prune-output "fatal error:" } // { dg-prune-output "failed to read" } // { dg-prune-output "compilation terminated" }
PING^1 [PATCH] cpp/remap: Only override if string matched
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604062.html Ok for trunk? Kind regards, Torbjörn On 2022-10-20 22:48, Torbjörn SVENSSON wrote: For systems with HAVE_DOS_BASED_FILE_SYSTEM set, only override the pointer if the backslash pattern matches. Output without this patch: .../gcc/testsuite/gcc.dg/cpp/pr71681-2.c:5:10: fatal error: a/t2.h: No such file or directory With patch applied, no output and the test case succeeds. libcpp/ChangeLog * files.cc: Ensure pattern matches before use. Signed-off-by: Torbjörn SVENSSON --- libcpp/files.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcpp/files.cc b/libcpp/files.cc index 24208f7b0f8..a18b1caf48d 100644 --- a/libcpp/files.cc +++ b/libcpp/files.cc @@ -1833,7 +1833,7 @@ remap_filename (cpp_reader *pfile, _cpp_file *file) #ifdef HAVE_DOS_BASED_FILE_SYSTEM { const char *p2 = strchr (fname, '\\'); - if (!p || (p > p2)) + if (!p || (p2 && p > p2)) p = p2; } #endif
PING^1 [PATCH] arm: Allow to override location of .gnu.sgstubs section
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603878.html Kind regards, Torbjörn On 2022-10-19 11:42, Torbjörn SVENSSON wrote: Depending on the DejaGNU board definition, the .gnu.sgstubs section might be placed on different locations in order to suite the target. With this patch, the start location of the section is overrideable from the board definition with the fallback of the previously hardcoded location. gcc/testsuite/ChangeLog: * gcc.target/arm/cmse/bitfield-1.c: Use overridable location. * gcc.target/arm/cmse/bitfield-2.c: Likewise. * gcc.target/arm/cmse/bitfield-3.c: Likewise. * gcc.target/arm/cmse/cmse-20.c: Likewise. * gcc.target/arm/cmse/struct-1.c: Likewise. * gcc.target/arm/cmse/cmse.exp (cmse_sgstubs): New. Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c | 2 +- gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c | 2 +- gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c | 2 +- gcc/testsuite/gcc.target/arm/cmse/cmse-20.c| 2 +- gcc/testsuite/gcc.target/arm/cmse/cmse.exp | 11 +++ gcc/testsuite/gcc.target/arm/cmse/struct-1.c | 2 +- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c b/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c index 5685f744435..c1221bef29f 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c @@ -1,5 +1,5 @@ /* This test is executed only if the execution engine supports CMSE instructions. */ -/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x0040" } */ +/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=[cmse_sgstubs]" } */ typedef struct { diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c b/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c index 7a794d44644..79e9a3efc93 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c @@ -1,5 +1,5 @@ /* This test is executed only if the execution engine supports CMSE instructions. */ -/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x0040" } */ +/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=[cmse_sgstubs]" } */ typedef struct { diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c b/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c index 5875f8dff48..d621a802ee1 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c @@ -1,5 +1,5 @@ /* This test is executed only if the execution engine supports CMSE instructions. */ -/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x0040" } */ +/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=[cmse_sgstubs]" } */ typedef struct { diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c index 08e89bff637..bbea9358870 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c @@ -1,5 +1,5 @@ /* This test is executed only if the execution engine supports CMSE instructions. */ -/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x0040" } */ +/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=[cmse_sgstubs]" } */ #include #include diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse.exp b/gcc/testsuite/gcc.target/arm/cmse/cmse.exp index 436dd71ef89..1df5d56c6d5 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/cmse.exp +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse.exp @@ -44,6 +44,17 @@ if {[is-effective-target arm_cmse_hw]} then { set saved-lto_torture_options ${LTO_TORTURE_OPTIONS} set LTO_TORTURE_OPTIONS "" +# Return the start address of the .gnu.sgstubs section. +proc cmse_sgstubs {} { +# Allow to override the location of .gnu.sgstubs section. +set tboard [target_info name] +if {[board_info $tboard exists cmse_sgstubs]} { + return [board_info $tboard cmse_sgstubs] +} + +return "0x0040" +} + # These are for both baseline and mainline. gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] \ "" $DEFAULT_CFLAGS diff --git a/gcc/testsuite/gcc.target/arm/cmse/struct-1.c b/gcc/testsuite/gcc.target/arm/cmse/struct-1.c index 75a99f487e7..bebd059b13f 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/struct-1.c +++ b/gcc/testsuite/gcc.target/arm/cmse/struct-1.c @@ -1,5 +1,5 @@ /* This test is executed only if the execution engine supports CMSE instructions. */ -/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x0040" } */ +/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=[cmse_sgstubs]" } */ typedef struct {
PING^1 [PATCH] testsuite: Windows paths use \ and not /
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/604312.html Ok for trunk? Kind regards, Torbjörn On 2022-10-25 17:15, Torbjörn SVENSSON wrote: Without this patch, the following error is reported on Windows: In file included from t:\build\arm-none-eabi\include\c++\11.3.1\string:54, from t:\build\arm-none-eabi\include\c++\11.3.1\bits\locale_classes.h:40, from t:\build\arm-none-eabi\include\c++\11.3.1\bits\ios_base.h:41, from t:\build\arm-none-eabi\include\c++\11.3.1\ios:42, from t:\build\arm-none-eabi\include\c++\11.3.1\ostream:38, from t:\build\arm-none-eabi\include\c++\11.3.1\iostream:39: t:\build\arm-none-eabi\include\c++\11.3.1\bits\range_access.h:36:10: note: include 't:\build\arm-none-eabi\include\c++\11.3.1\initializer_list' translated to import arm-none-eabi-g++.exe: warning: .../gcc/testsuite/g++.dg/modules/pr99023_b.X: linker input file unused because linking not done FAIL: g++.dg/modules/pr99023_b.X -std=c++2a dg-regexp 6 not found: "[^\n]*: note: include '[^\n]*/initializer_list' translated to import\n" gcc/testsuite/ChangeLog: * g++.dg/modules/pr99023_b.X: Match Windows paths too. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/g++.dg/modules/pr99023_b.X | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/g++.dg/modules/pr99023_b.X b/gcc/testsuite/g++.dg/modules/pr99023_b.X index 3d82f34868b..ca5f32e5bcc 100644 --- a/gcc/testsuite/g++.dg/modules/pr99023_b.X +++ b/gcc/testsuite/g++.dg/modules/pr99023_b.X @@ -3,5 +3,5 @@ // { dg-prune-output {linker input file unused} } -// { dg-regexp {[^\n]*: note: include '[^\n]*/initializer_list' translated to import\n} } +// { dg-regexp {[^\n]*: note: include '[^\n]*[/\\]initializer_list' translated to import\n} } NO DO NOT COMPILE
Re: PING^4 [PATCH] testsuite: Verify that module-mapper is available
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602844.html Ok for trunk? Kind regards, Torbjörn On 2022-10-25 16:24, Torbjorn SVENSSON via Gcc-patches wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603544.html Kind regards, Torbjörn On 2022-10-14 09:42, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602843.html Kind regards, Torbjörn On 2022-10-05 11:17, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602111.html Kind regards, Torbjörn On 2022-09-23 14:03, Torbjörn SVENSSON wrote: For some test cases, it's required that the optional module mapper "g++-mapper-server" is built. As the server is not required, the test cases will fail if it can't be found. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_is_prog_name_available): New. * lib/target-supports-dg.exp (dg-require-prog-name-available): New. * g++.dg/modules/modules.exp: Verify avilability of module mapper. Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/g++.dg/modules/modules.exp | 31 gcc/testsuite/lib/target-supports-dg.exp | 15 gcc/testsuite/lib/target-supports.exp | 15 3 files changed, 61 insertions(+) diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp index afb323d0efd..4784803742a 100644 --- a/gcc/testsuite/g++.dg/modules/modules.exp +++ b/gcc/testsuite/g++.dg/modules/modules.exp @@ -279,6 +279,29 @@ proc module-init { src } { return $option_list } +# Return 1 if requirements are met +proc module-check-requirements { tests } { + foreach test $tests { + set tmp [dg-get-options $test] + foreach op $tmp { + switch [lindex $op 0] { + "dg-additional-options" { + # Example strings to match: + # -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\ -t\\ [srcdir]/inc-xlate-1.map + # -fmodules-ts -fmodule-mapper=|@g++-mapper-server + if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)} [lindex $op 2] dummy dummy2 prog] { + verbose "Checking that mapper exist: $prog" + if { ![ check_is_prog_name_available $prog ] } { + return 0 + } + } + } + } + } + } + return 1 +} + # cleanup any detritus from previous run cleanup_module_files [find $DEFAULT_REPO *.gcm] @@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] { set tests [lsort [find [file dirname $src] \ [regsub {_a.[CHX]$} [file tail $src] {_[a-z].[CHX]}]]] + if { ![module-check-requirements $tests] } { + set testcase [regsub {_a.[CH]} $src {}] + set testcase \ + [string range $testcase [string length "$srcdir/"] end] + unsupported $testcase + continue + } + set std_list [module-init $src] foreach std $std_list { set mod_files {} diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index aa2164bc789..6ce3b2b1a1b 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -683,3 +683,18 @@ proc dg-require-symver { args } { set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] } } + +# If this target does not provide prog named "$args", skip this test. + +proc dg-require-prog-name-available { args } { + # The args are within another list; pull them out. + set args [lindex $args 0] + + set prog [lindex $args 1] + + if { ![ check_is_prog_name_available $prog ] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } +} + diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 703aba412a6..c3b7a6c17b3 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -11928,3 +11928,18 @@ main: .byte 0 } ""] } + +# Return 1 if this target has prog named "$prog", 0 otherwise. + +proc check_is_prog_name_available { prog } { + global tool + + set options [list "additional_flags=-print-prog-name=$prog"] + set output [lindex [${tool}_target_compile "" "" "none" $options] 0] + + if { $output == $prog } { + return 0 + } + + return 1 +}
Re: [PATCH] IRA: Make sure array is big enough
On 2022-10-26 22:26, Vladimir Makarov wrote: On 2022-10-25 06:01, Torbjörn SVENSSON wrote: In commit 081c96621da, the call to resize_reg_info() was moved before the call to remove_scratches() and the latter one can increase the number of regs and that would cause an out of bounds usage on the reg_renumber global array. Without this patch, the following testcase randomly fails with: during RTL pass: ira In file included from /src/gcc/testsuite/gcc.dg/compat//struct-by-value-5b_y.c:13: /src/gcc/testsuite/gcc.dg/compat//struct-by-value-5b_y.c: In function 'checkgSf13': /src/gcc/testsuite/gcc.dg/compat//fp-struct-test-by-value-y.h:28:1: internal compiler error: Segmentation fault /src/gcc/testsuite/gcc.dg/compat//struct-by-value-5b_y.c:22:1: note: in expansion of macro 'TEST' gcc/ChangeLog: * ira.c: Resize array after reg number increased. The patch is ok to commit it into gcc-11,12 branches and master. Thank you for the review! Pushed to gcc-11, gcc-12 and master. Thank you for fixing this. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/ira.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/ira.cc b/gcc/ira.cc index 42c9cead9f8..d28a67b2546 100644 --- a/gcc/ira.cc +++ b/gcc/ira.cc @@ -5718,6 +5718,7 @@ ira (FILE *f) regstat_free_ri (); regstat_init_n_sets_and_refs (); regstat_compute_ri (); + resize_reg_info (); }; int max_regno_before_rm = max_reg_num ();
PING^3 [PATCH] testsuite: Verify that module-mapper is available
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603544.html Kind regards, Torbjörn On 2022-10-14 09:42, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602843.html Kind regards, Torbjörn On 2022-10-05 11:17, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602111.html Kind regards, Torbjörn On 2022-09-23 14:03, Torbjörn SVENSSON wrote: For some test cases, it's required that the optional module mapper "g++-mapper-server" is built. As the server is not required, the test cases will fail if it can't be found. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_is_prog_name_available): New. * lib/target-supports-dg.exp (dg-require-prog-name-available): New. * g++.dg/modules/modules.exp: Verify avilability of module mapper. Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/g++.dg/modules/modules.exp | 31 gcc/testsuite/lib/target-supports-dg.exp | 15 gcc/testsuite/lib/target-supports.exp | 15 3 files changed, 61 insertions(+) diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp index afb323d0efd..4784803742a 100644 --- a/gcc/testsuite/g++.dg/modules/modules.exp +++ b/gcc/testsuite/g++.dg/modules/modules.exp @@ -279,6 +279,29 @@ proc module-init { src } { return $option_list } +# Return 1 if requirements are met +proc module-check-requirements { tests } { + foreach test $tests { + set tmp [dg-get-options $test] + foreach op $tmp { + switch [lindex $op 0] { + "dg-additional-options" { + # Example strings to match: + # -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\ -t\\ [srcdir]/inc-xlate-1.map + # -fmodules-ts -fmodule-mapper=|@g++-mapper-server + if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)} [lindex $op 2] dummy dummy2 prog] { + verbose "Checking that mapper exist: $prog" + if { ![ check_is_prog_name_available $prog ] } { + return 0 + } + } + } + } + } + } + return 1 +} + # cleanup any detritus from previous run cleanup_module_files [find $DEFAULT_REPO *.gcm] @@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] { set tests [lsort [find [file dirname $src] \ [regsub {_a.[CHX]$} [file tail $src] {_[a-z].[CHX]}]]] + if { ![module-check-requirements $tests] } { + set testcase [regsub {_a.[CH]} $src {}] + set testcase \ + [string range $testcase [string length "$srcdir/"] end] + unsupported $testcase + continue + } + set std_list [module-init $src] foreach std $std_list { set mod_files {} diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index aa2164bc789..6ce3b2b1a1b 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -683,3 +683,18 @@ proc dg-require-symver { args } { set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] } } + +# If this target does not provide prog named "$args", skip this test. + +proc dg-require-prog-name-available { args } { + # The args are within another list; pull them out. + set args [lindex $args 0] + + set prog [lindex $args 1] + + if { ![ check_is_prog_name_available $prog ] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } +} + diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 703aba412a6..c3b7a6c17b3 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -11928,3 +11928,18 @@ main: .byte 0 } ""] } + +# Return 1 if this target has prog named "$prog", 0 otherwise. + +proc check_is_prog_name_available { prog } { + global tool + + set options [list "additional_flags=-print-prog-name=$prog"] + set output [lindex [${tool}_target_compile "" "" "none" $options] 0] + + if { $output == $prog } { + return 0 + } + + return 1 +}
Re: [PATCH] lto: Always quote path to touch
On 2022-10-24 10:07, Richard Biener wrote: On Fri, 21 Oct 2022, Torbj?rn SVENSSON wrote: When generating the makefile, make sure that the paths are quoted so that a native Windows path works within Cygwin. Without this patch, this error is reported by the DejaGNU test suite: make: [T:\ccMf0kI3.mk:3: T:\ccGEvdDp.ltrans0.ltrans.o] Error 1 (ignored) The generated makefile fragment without the patch: T:\ccGEvdDp.ltrans0.ltrans.o: @T:\build\bin\arm-none-eabi-g++.exe '-xlto' ... '-o' 'T:\ccGEvdDp.ltrans0.ltrans.o' 'T:\ccGEvdDp.ltrans0.o' @-touch -r T:\ccGEvdDp.ltrans0.o T:\ccGEvdDp.ltrans0.o.tem > /dev/null 2>&1 && mv T:\ccGEvdDp.ltrans0.o.tem T:\ccGEvdDp.ltrans0.o .PHONY: all all: \ T:\ccGEvdDp.ltrans0.ltrans.o With the patch, the touch line would be replace with: @-touch -r "T:\ccGEvdDp.ltrans0.o" "T:\ccGEvdDp.ltrans0.o.tem" > /dev/null 2>&1 && mv "T:\ccGEvdDp.ltrans0.o.tem" "T:\ccGEvdDp.ltrans0.o" gcc/ChangeLog: OK. Thanks, Richard. * lto-wrapper.cc: Quote paths in makefile. Co-Authored-By: Yvan ROUX Signed-off-by: Torbj?rn SVENSSON --- gcc/lto-wrapper.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc index 9a764702ffc..b12bcc1ad27 100644 --- a/gcc/lto-wrapper.cc +++ b/gcc/lto-wrapper.cc @@ -2010,8 +2010,8 @@ cont: truncate them as soon as we have processed it. This reduces temporary disk-space usage. */ if (! save_temps) - fprintf (mstream, "\t@-touch -r %s %s.tem > /dev/null 2>&1 " -"&& mv %s.tem %s\n", + fprintf (mstream, "\t@-touch -r \"%s\" \"%s.tem\" > /dev/null " +"2>&1 && mv \"%s.tem\" \"%s\"\n", input_name, input_name, input_name, input_name); } else Pushed.
Re: [PATCH v4] testsuite: Sanitize fails for SP FPU on Arm
On 2022-10-20 20:19, Joseph Myers wrote: On Wed, 19 Oct 2022, Torbjörn SVENSSON via Gcc-patches wrote: This patch stops reporting fails for Arm targets with single precision floating point unit for types wider than 32 bits (the width of float on arm-none-eabi). As reported in PR102017, fenv is reported as supported in recent versions of newlib. At the same time, for some Arm targets, the implementation in libgcc does not support exceptions and thus, the test fails with a call to abort(). This patch is OK. Thanks Joseph! Pushed.
Re: [PATCH] arm: Allow to override location of .gnu.sgstubs section
Hi Christophe, On 2022-10-19 11:52, Christophe Lyon wrote: Hi Torbjörn, This looks like a nice improvement to me ;-) On 10/19/22 11:42, Torbjörn SVENSSON via Gcc-patches wrote: Depending on the DejaGNU board definition, the .gnu.sgstubs section might be placed on different locations in order to suite the target. typo: suite -> suit With this patch, the start location of the section is overrideable from the board definition with the fallback of the previously hardcoded location. gcc/testsuite/ChangeLog: * gcc.target/arm/cmse/bitfield-1.c: Use overridable location. * gcc.target/arm/cmse/bitfield-2.c: Likewise. * gcc.target/arm/cmse/bitfield-3.c: Likewise. * gcc.target/arm/cmse/cmse-20.c: Likewise. * gcc.target/arm/cmse/struct-1.c: Likewise. * gcc.target/arm/cmse/cmse.exp (cmse_sgstubs): New. Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c | 2 +- gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c | 2 +- gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c | 2 +- gcc/testsuite/gcc.target/arm/cmse/cmse-20.c | 2 +- gcc/testsuite/gcc.target/arm/cmse/cmse.exp | 11 +++ gcc/testsuite/gcc.target/arm/cmse/struct-1.c | 2 +- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c b/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c index 5685f744435..c1221bef29f 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-1.c @@ -1,5 +1,5 @@ /* This test is executed only if the execution engine supports CMSE instructions. */ -/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x0040" } */ +/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=[cmse_sgstubs]" } */ typedef struct { diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c b/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c index 7a794d44644..79e9a3efc93 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-2.c @@ -1,5 +1,5 @@ /* This test is executed only if the execution engine supports CMSE instructions. */ -/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x0040" } */ +/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=[cmse_sgstubs]" } */ typedef struct { diff --git a/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c b/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c index 5875f8dff48..d621a802ee1 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c +++ b/gcc/testsuite/gcc.target/arm/cmse/bitfield-3.c @@ -1,5 +1,5 @@ /* This test is executed only if the execution engine supports CMSE instructions. */ -/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x0040" } */ +/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=[cmse_sgstubs]" } */ typedef struct { diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c index 08e89bff637..bbea9358870 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c @@ -1,5 +1,5 @@ /* This test is executed only if the execution engine supports CMSE instructions. */ -/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x0040" } */ +/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=[cmse_sgstubs]" } */ #include #include diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse.exp b/gcc/testsuite/gcc.target/arm/cmse/cmse.exp index 436dd71ef89..1df5d56c6d5 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/cmse.exp +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse.exp @@ -44,6 +44,17 @@ if {[is-effective-target arm_cmse_hw]} then { set saved-lto_torture_options ${LTO_TORTURE_OPTIONS} set LTO_TORTURE_OPTIONS "" +# Return the start address of the .gnu.sgstubs section. +proc cmse_sgstubs {} { + # Allow to override the location of .gnu.sgstubs section. + set tboard [target_info name] + if {[board_info $tboard exists cmse_sgstubs]} { + return [board_info $tboard cmse_sgstubs] + } + + return "0x0040" +} + I am not sure if/where this new cmse_sgstubs target-board property needs to be documented? I'm not sure either. Everytime I need to do something with the target-board properties, I just look at other examples in the tree and replicate what they do. I'm also not sure if "cmse_sgstubs" is a good name, but I was unable to come up with a more meaningful name that was not a mile long... If there is any sugession on a better name, please speak up! :) Kind regards, Torbjörn
PING^1 [PATCH v3] testsuite: Sanitize fails for SP FPU on Arm
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603054.html Kind regards, Torbjörn On 2022-10-07 15:28, Torbjörn SVENSSON wrote: This patch stops reporting fails for Arm targets with single precision floating point unit for types wider than 32 bits (the width of float on arm-none-eabi). As reported in PR102017, fenv is reported as supported in recent versions of newlib. At the same time, for some Arm targets, the implementation in libgcc does not support exceptions and thus, the test fails with a call to abort(). gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_fenv_exceptions_double): New. (check_effective_target_fenv_exceptions_long_double): New. * gcc.dg/c2x-float-7.c: Split into 3 tests... * gcc.dg/c2x-float-7a.c: Float part of c2x-float-7.c. * gcc.dg/c2x-float-7b.c: Double part of c2x-float-7.c. * gcc.dg/c2x-float-7c.c: Long double part of c2x-float-7.c. * gcc.dg/pr95115.c: Switch to fenv_exceptions_double. * gcc.dg/torture/float32x-nan-floath.c: Likewise. * gcc.dg/torture/float32x-nan.c: Likewise. * gcc.dg/torture/float64-nan-floath.c: Likewise. * gcc.dg/torture/float64-nan.c: Likewise. * gcc.dg/torture/inf-compare-1.c: Likewise. * gcc.dg/torture/inf-compare-2.c: Likewise. * gcc.dg/torture/inf-compare-3.c: Likewise. * gcc.dg/torture/inf-compare-4.c: Likewise. * gcc.dg/torture/inf-compare-5.c: Likewise. * gcc.dg/torture/inf-compare-6.c: Likewise. * gcc.dg/torture/inf-compare-7.c: Likewise. * gcc.dg/torture/inf-compare-8.c: Likewise. * gcc.dg/torture/inf-compare-1-float.c: New test. * gcc.dg/torture/inf-compare-2-float.c: New test. * gcc.dg/torture/inf-compare-3-float.c: New test. * gcc.dg/torture/inf-compare-4-float.c: New test. * gcc.dg/torture/inf-compare-5-float.c: New test. * gcc.dg/torture/inf-compare-6-float.c: New test. * gcc.dg/torture/inf-compare-7-float.c: New test. * gcc.dg/torture/inf-compare-8-float.c: New test. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/gcc.dg/c2x-float-7.c| 49 gcc/testsuite/gcc.dg/c2x-float-7a.c | 32 gcc/testsuite/gcc.dg/c2x-float-7b.c | 32 gcc/testsuite/gcc.dg/c2x-float-7c.c | 32 gcc/testsuite/gcc.dg/pr95115.c| 2 +- .../gcc.dg/torture/float32x-nan-floath.c | 2 +- gcc/testsuite/gcc.dg/torture/float32x-nan.c | 2 +- .../gcc.dg/torture/float64-nan-floath.c | 2 +- gcc/testsuite/gcc.dg/torture/float64-nan.c| 2 +- .../gcc.dg/torture/inf-compare-1-float.c | 21 ++ gcc/testsuite/gcc.dg/torture/inf-compare-1.c | 2 +- .../gcc.dg/torture/inf-compare-2-float.c | 21 ++ gcc/testsuite/gcc.dg/torture/inf-compare-2.c | 2 +- .../gcc.dg/torture/inf-compare-3-float.c | 21 ++ gcc/testsuite/gcc.dg/torture/inf-compare-3.c | 2 +- .../gcc.dg/torture/inf-compare-4-float.c | 21 ++ gcc/testsuite/gcc.dg/torture/inf-compare-4.c | 2 +- .../gcc.dg/torture/inf-compare-5-float.c | 19 + gcc/testsuite/gcc.dg/torture/inf-compare-5.c | 2 +- .../gcc.dg/torture/inf-compare-6-float.c | 19 + gcc/testsuite/gcc.dg/torture/inf-compare-6.c | 2 +- .../gcc.dg/torture/inf-compare-7-float.c | 19 + gcc/testsuite/gcc.dg/torture/inf-compare-7.c | 2 +- .../gcc.dg/torture/inf-compare-8-float.c | 19 + gcc/testsuite/gcc.dg/torture/inf-compare-8.c | 2 +- gcc/testsuite/lib/target-supports.exp | 74 +++ 26 files changed, 343 insertions(+), 62 deletions(-) delete mode 100644 gcc/testsuite/gcc.dg/c2x-float-7.c create mode 100644 gcc/testsuite/gcc.dg/c2x-float-7a.c create mode 100644 gcc/testsuite/gcc.dg/c2x-float-7b.c create mode 100644 gcc/testsuite/gcc.dg/c2x-float-7c.c create mode 100644 gcc/testsuite/gcc.dg/torture/inf-compare-1-float.c create mode 100644 gcc/testsuite/gcc.dg/torture/inf-compare-2-float.c create mode 100644 gcc/testsuite/gcc.dg/torture/inf-compare-3-float.c create mode 100644 gcc/testsuite/gcc.dg/torture/inf-compare-4-float.c create mode 100644 gcc/testsuite/gcc.dg/torture/inf-compare-5-float.c create mode 100644 gcc/testsuite/gcc.dg/torture/inf-compare-6-float.c create mode 100644 gcc/testsuite/gcc.dg/torture/inf-compare-7-float.c create mode 100644 gcc/testsuite/gcc.dg/torture/inf-compare-8-float.c diff --git a/gcc/testsuite/gcc.dg/c2x-float-7.c b/gcc/testsuite/gcc.dg/c2x-float-7.c deleted file mode 100644 index 0c90ff24165..000 --- a/gcc/testsuite/gcc.dg/c2x-float-7.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Test SNAN macros. Runtime exceptions test, to verify NaN is - signaling. */ -/* { dg-do run } */ -/* { dg-require-effective-target fenv_exceptions } */ -/* { dg-options "-std=c2x -peda
PING^2 [PATCH] testsuite: Verify that module-mapper is available
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602843.html Kind regards, Torbjörn On 2022-10-05 11:17, Torbjorn SVENSSON wrote: Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602111.html Kind regards, Torbjörn On 2022-09-23 14:03, Torbjörn SVENSSON wrote: For some test cases, it's required that the optional module mapper "g++-mapper-server" is built. As the server is not required, the test cases will fail if it can't be found. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_is_prog_name_available): New. * lib/target-supports-dg.exp (dg-require-prog-name-available): New. * g++.dg/modules/modules.exp: Verify avilability of module mapper. Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/g++.dg/modules/modules.exp | 31 gcc/testsuite/lib/target-supports-dg.exp | 15 gcc/testsuite/lib/target-supports.exp | 15 3 files changed, 61 insertions(+) diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp index afb323d0efd..4784803742a 100644 --- a/gcc/testsuite/g++.dg/modules/modules.exp +++ b/gcc/testsuite/g++.dg/modules/modules.exp @@ -279,6 +279,29 @@ proc module-init { src } { return $option_list } +# Return 1 if requirements are met +proc module-check-requirements { tests } { + foreach test $tests { + set tmp [dg-get-options $test] + foreach op $tmp { + switch [lindex $op 0] { + "dg-additional-options" { + # Example strings to match: + # -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\ -t\\ [srcdir]/inc-xlate-1.map + # -fmodules-ts -fmodule-mapper=|@g++-mapper-server + if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)} [lindex $op 2] dummy dummy2 prog] { + verbose "Checking that mapper exist: $prog" + if { ![ check_is_prog_name_available $prog ] } { + return 0 + } + } + } + } + } + } + return 1 +} + # cleanup any detritus from previous run cleanup_module_files [find $DEFAULT_REPO *.gcm] @@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] { set tests [lsort [find [file dirname $src] \ [regsub {_a.[CHX]$} [file tail $src] {_[a-z].[CHX]}]]] + if { ![module-check-requirements $tests] } { + set testcase [regsub {_a.[CH]} $src {}] + set testcase \ + [string range $testcase [string length "$srcdir/"] end] + unsupported $testcase + continue + } + set std_list [module-init $src] foreach std $std_list { set mod_files {} diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index aa2164bc789..6ce3b2b1a1b 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -683,3 +683,18 @@ proc dg-require-symver { args } { set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] } } + +# If this target does not provide prog named "$args", skip this test. + +proc dg-require-prog-name-available { args } { + # The args are within another list; pull them out. + set args [lindex $args 0] + + set prog [lindex $args 1] + + if { ![ check_is_prog_name_available $prog ] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } +} + diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 703aba412a6..c3b7a6c17b3 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -11928,3 +11928,18 @@ main: .byte 0 } ""] } + +# Return 1 if this target has prog named "$prog", 0 otherwise. + +proc check_is_prog_name_available { prog } { + global tool + + set options [list "additional_flags=-print-prog-name=$prog"] + set output [lindex [${tool}_target_compile "" "" "none" $options] 0] + + if { $output == $prog } { + return 0 + } + + return 1 +}
Re: PING^1 [PATCH] testsuite: 'b' instruction can't do long enough jumps
On 2022-10-05 11:51, Kyrylo Tkachov wrote: Hi Torbjörn, -Original Message- From: Torbjorn SVENSSON Sent: Wednesday, October 5, 2022 10:28 AM To: Kyrylo Tkachov Cc: Yvan Roux Subject: Fwd: PING^1 [PATCH] testsuite: 'b' instruction can't do long enough jumps Hi Kyrill, I checked with Richard Sandiford if he could review this patch, but he pointed to you. Do you think that you can take a look it? This is ok. I don't think it changes any of the things we want to actually test for in these cases. Thanks, Kyrill Thank you! Pushed to master branch 1a46a0a8b30405ea353a758971634dabeee89eaf. Kind regards, Torbjörn
Re: [PATCH] testsuite: /dev/null is not accessible on Windows
Hi, On 2022-10-05 11:34, Jonathan Yong via Gcc-patches wrote: On 9/29/22 17:38, Torbjörn SVENSSON via Gcc-patches wrote: When running the DejaGNU testsuite on a toolchain built for native Windows, the path /dev/null can't be used to open a stream to void. On native Windows, the resource is instead named "nul". The error would look like this: c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: cannot find @/dev/null: No such file or directory Patch has been verified on Windows and Linux. gcc/testsuite: * gcc.misc-tests/outputs.exp: Use "@nul" for Windows, "@/dev/null" for other environments. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/gcc.misc-tests/outputs.exp | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/gcc.misc-tests/outputs.exp b/gcc/testsuite/gcc.misc-tests/outputs.exp index ab919db1ccb..3fe7270fa63 100644 --- a/gcc/testsuite/gcc.misc-tests/outputs.exp +++ b/gcc/testsuite/gcc.misc-tests/outputs.exp @@ -78,6 +78,13 @@ if {[board_info $dest exists output_format]} { append link_options " additional_flags=-Wl,-oformat,[board_info $dest output_format]" } + +set devnull "/dev/null" +if { [info exists ::env(OS)] && [string match "Windows*" $::env(OS)] } { + # Windows uses special file named "nul" as a substitute for /dev/null + set devnull "nul" +} + # Avoid possible influence from the make jobserver, # otherwise ltrans0.ltrans_args files may be missing. if [info exists env(MAKEFLAGS)] { @@ -353,10 +360,10 @@ outest "$b-21 exe savetmp named2" $mult "-o $b.exe -save-temps" {} {{--1.i --1.s # Additional files are created when an @file is used if !$skip_atsave { -outest "$b-22 exe savetmp namedb-2" $sing "@/dev/null -o $b.exe -save-temps" {} {{--0.i --0.s --0.o .args.0 !!$gld .ld1_args !0 .exe}} -outest "$b-23 exe savetmp named2-2" $mult "@/dev/null -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .args.0 !!$gld .ld1_args !0 .exe}} -outest "$b-24 exe savetmp named2-3" $mult "@/dev/null -I dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 !!$gld .ld1_args !0 .exe}} -outest "$b-25 exe savetmp named2-4" $mult "@/dev/null -I dummy -L dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 .args.3 !!$gld .ld1_args !0 .exe}} +outest "$b-22 exe savetmp namedb-2" $sing "@$devnull -o $b.exe -save-temps" {} {{--0.i --0.s --0.o .args.0 !!$gld .ld1_args !0 .exe}} +outest "$b-23 exe savetmp named2-2" $mult "@$devnull -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .args.0 !!$gld .ld1_args !0 .exe}} +outest "$b-24 exe savetmp named2-3" $mult "@$devnull -I dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 !!$gld .ld1_args !0 .exe}} +outest "$b-25 exe savetmp named2-4" $mult "@$devnull -I dummy -L dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 .args.3 !!$gld .ld1_args !0 .exe}} } # Setting the main output to a dir selects it as the default aux&dump @@ -714,7 +721,7 @@ outest "$b-291 lto mult named-2" $mult "-o $b.exe -O2 -flto -fno-use-linker-plug outest "$b-292 lto sing nameddir-2" $sing "-o dir/$b.exe -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf --0.c.???r.final .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe} {}} outest "$b-293 lto mult nameddir-2" $mult "-o dir/$b.exe -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --1.c.???r.final --2.c.???i.icf --2.c.???r.final .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe} {}} if !$skip_atsave { -outest "$b-294 lto sing unnamed-3" $sing "@/dev/null -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage -save-temps $oaout" {} {{a--0.c.???i.icf a--0.c.???r.final a.wpa.???i.icf a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a--0.o a--0.s a--0.i a.ltrans0.o a.ltrans.out a.ltrans0.ltrans.o a.ltrans0.ltrans_args a.args.0 a.ltrans0.ltrans.s a.wpa.args.0 a.lto_args a.ld1_args a.ltrans_args a.ltrans0.ltrans.args.0 a.ld_args $aout}} +outest "$b-294 lto sing unnamed-3" $sing "@$devnull -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage -save-temps $oaout" {} {{a--0.c.???i.icf a--0.c.???r.final a.wpa.???i.icf a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a--0.o a--0.s a--0.i a.ltrans0.o a.ltrans.out a.ltrans0.ltrans.o a.ltrans0.ltrans_args a.args.0 a.ltrans0.ltrans.s a.wpa.args.0 a.lto_args a.ld1_args a.ltrans_args a.ltrans0.ltrans.args.0 a.ld_args $aout}} } } Thanks, looks good to me, will push to master soon. Thanks for the review. I can p
PING^1 [PATCH] testsuite: /dev/null is not accessible on Windows
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602534.html Kind regards, Torbjörn On 2022-09-29 19:38, Torbjörn SVENSSON wrote: When running the DejaGNU testsuite on a toolchain built for native Windows, the path /dev/null can't be used to open a stream to void. On native Windows, the resource is instead named "nul". The error would look like this: c:/arm-11.3.rel1/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: cannot find @/dev/null: No such file or directory Patch has been verified on Windows and Linux. gcc/testsuite: * gcc.misc-tests/outputs.exp: Use "@nul" for Windows, "@/dev/null" for other environments. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/gcc.misc-tests/outputs.exp | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/gcc.misc-tests/outputs.exp b/gcc/testsuite/gcc.misc-tests/outputs.exp index ab919db1ccb..3fe7270fa63 100644 --- a/gcc/testsuite/gcc.misc-tests/outputs.exp +++ b/gcc/testsuite/gcc.misc-tests/outputs.exp @@ -78,6 +78,13 @@ if {[board_info $dest exists output_format]} { append link_options " additional_flags=-Wl,-oformat,[board_info $dest output_format]" } + +set devnull "/dev/null" +if { [info exists ::env(OS)] && [string match "Windows*" $::env(OS)] } { +# Windows uses special file named "nul" as a substitute for /dev/null +set devnull "nul" +} + # Avoid possible influence from the make jobserver, # otherwise ltrans0.ltrans_args files may be missing. if [info exists env(MAKEFLAGS)] { @@ -353,10 +360,10 @@ outest "$b-21 exe savetmp named2" $mult "-o $b.exe -save-temps" {} {{--1.i --1.s # Additional files are created when an @file is used if !$skip_atsave { -outest "$b-22 exe savetmp namedb-2" $sing "@/dev/null -o $b.exe -save-temps" {} {{--0.i --0.s --0.o .args.0 !!$gld .ld1_args !0 .exe}} -outest "$b-23 exe savetmp named2-2" $mult "@/dev/null -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .args.0 !!$gld .ld1_args !0 .exe}} -outest "$b-24 exe savetmp named2-3" $mult "@/dev/null -I dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 !!$gld .ld1_args !0 .exe}} -outest "$b-25 exe savetmp named2-4" $mult "@/dev/null -I dummy -L dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 .args.3 !!$gld .ld1_args !0 .exe}} +outest "$b-22 exe savetmp namedb-2" $sing "@$devnull -o $b.exe -save-temps" {} {{--0.i --0.s --0.o .args.0 !!$gld .ld1_args !0 .exe}} +outest "$b-23 exe savetmp named2-2" $mult "@$devnull -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .args.0 !!$gld .ld1_args !0 .exe}} +outest "$b-24 exe savetmp named2-3" $mult "@$devnull -I dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 !!$gld .ld1_args !0 .exe}} +outest "$b-25 exe savetmp named2-4" $mult "@$devnull -I dummy -L dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 .args.3 !!$gld .ld1_args !0 .exe}} } # Setting the main output to a dir selects it as the default aux&dump @@ -714,7 +721,7 @@ outest "$b-291 lto mult named-2" $mult "-o $b.exe -O2 -flto -fno-use-linker-plug outest "$b-292 lto sing nameddir-2" $sing "-o dir/$b.exe -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf --0.c.???r.final .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe} {}} outest "$b-293 lto mult nameddir-2" $mult "-o dir/$b.exe -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --1.c.???r.final --2.c.???i.icf --2.c.???r.final .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe} {}} if !$skip_atsave { -outest "$b-294 lto sing unnamed-3" $sing "@/dev/null -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage -save-temps $oaout" {} {{a--0.c.???i.icf a--0.c.???r.final a.wpa.???i.icf a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a--0.o a--0.s a--0.i a.ltrans0.o a.ltrans.out a.ltrans0.ltrans.o a.ltrans0.ltrans_args a.args.0 a.ltrans0.ltrans.s a.wpa.args.0 a.lto_args a.ld1_args a.ltrans_args a.ltrans0.ltrans.args.0 a.ld_args $aout}} +outest "$b-294 lto sing unnamed-3" $sing "@$devnull -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage -save-temps $oaout" {} {{a--0.c.???i.icf a--0.c.???r.final a.wpa.???i.icf a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a--0.o a--0.s a--0.i a.ltrans0.o a.ltrans.out a.ltrans0.ltrans.o a.ltrans0.ltrans_args a.args.0 a.ltrans0.ltrans.s a.wpa.args.0 a.lto_args a.ld1_args a.ltrans_args a.ltrans0.ltrans.args.0 a.ld_args $aout}} } }
PING^1 [PATCH] testsuite: Verify that module-mapper is available
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602111.html Kind regards, Torbjörn On 2022-09-23 14:03, Torbjörn SVENSSON wrote: For some test cases, it's required that the optional module mapper "g++-mapper-server" is built. As the server is not required, the test cases will fail if it can't be found. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_is_prog_name_available): New. * lib/target-supports-dg.exp (dg-require-prog-name-available): New. * g++.dg/modules/modules.exp: Verify avilability of module mapper. Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/g++.dg/modules/modules.exp | 31 gcc/testsuite/lib/target-supports-dg.exp | 15 gcc/testsuite/lib/target-supports.exp| 15 3 files changed, 61 insertions(+) diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp index afb323d0efd..4784803742a 100644 --- a/gcc/testsuite/g++.dg/modules/modules.exp +++ b/gcc/testsuite/g++.dg/modules/modules.exp @@ -279,6 +279,29 @@ proc module-init { src } { return $option_list } +# Return 1 if requirements are met +proc module-check-requirements { tests } { +foreach test $tests { + set tmp [dg-get-options $test] + foreach op $tmp { + switch [lindex $op 0] { + "dg-additional-options" { + # Example strings to match: + # -fmodules-ts -fmodule-mapper=|@g++-mapper-server\\ -t\\ [srcdir]/inc-xlate-1.map + # -fmodules-ts -fmodule-mapper=|@g++-mapper-server + if [regexp -- {(^| )-fmodule-mapper=\|@([^\\ ]*)} [lindex $op 2] dummy dummy2 prog] { + verbose "Checking that mapper exist: $prog" + if { ![ check_is_prog_name_available $prog ] } { + return 0 + } + } + } + } + } +} +return 1 +} + # cleanup any detritus from previous run cleanup_module_files [find $DEFAULT_REPO *.gcm] @@ -307,6 +330,14 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] { set tests [lsort [find [file dirname $src] \ [regsub {_a.[CHX]$} [file tail $src] {_[a-z].[CHX]}]]] + if { ![module-check-requirements $tests] } { + set testcase [regsub {_a.[CH]} $src {}] + set testcase \ + [string range $testcase [string length "$srcdir/"] end] + unsupported $testcase + continue + } + set std_list [module-init $src] foreach std $std_list { set mod_files {} diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index aa2164bc789..6ce3b2b1a1b 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -683,3 +683,18 @@ proc dg-require-symver { args } { set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] } } + +# If this target does not provide prog named "$args", skip this test. + +proc dg-require-prog-name-available { args } { +# The args are within another list; pull them out. +set args [lindex $args 0] + +set prog [lindex $args 1] + +if { ![ check_is_prog_name_available $prog ] } { +upvar dg-do-what dg-do-what +set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] +} +} + diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 703aba412a6..c3b7a6c17b3 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -11928,3 +11928,18 @@ main: .byte 0 } ""] } + +# Return 1 if this target has prog named "$prog", 0 otherwise. + +proc check_is_prog_name_available { prog } { +global tool + +set options [list "additional_flags=-print-prog-name=$prog"] +set output [lindex [${tool}_target_compile "" "" "none" $options] 0] + +if { $output == $prog } { +return 0 +} + +return 1 +}
PING^1 [PATCH] testsuite: Windows reports errors with CreateProcess
Hi, Ping, https://gcc.gnu.org/pipermail/gcc-patches/2022-September/602541.html Kind regards, Torbjörn On 2022-09-29 20:07, Torbjörn SVENSSON wrote: When the mapper can't be executed, Windows report the error like: .../bad-mapper-1.C: error: failed CreateProcess mapper 'this-will-not-work' On Linux, the same error is reported this way: .../bad-mapper-1.C: error: failed execvp mapper 'this-will-not-work' This patch allows both output forms to be accepted. Patch has been verified on Windows and Linux. gcc/testsuite: * g++.dg/modules/bad-mapper-1.C: Also accept CreateProcess. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/g++.dg/modules/bad-mapper-1.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/g++.dg/modules/bad-mapper-1.C b/gcc/testsuite/g++.dg/modules/bad-mapper-1.C index 6d0ed4b5895..4b2312885d8 100644 --- a/gcc/testsuite/g++.dg/modules/bad-mapper-1.C +++ b/gcc/testsuite/g++.dg/modules/bad-mapper-1.C @@ -1,6 +1,6 @@ // { dg-additional-options "-fmodules-ts -fmodule-mapper=|this-will-not-work" } import unique1.bob; -// { dg-error "-:failed exec.*mapper.* .*this-will-not-work" "" { target { ! { *-*-darwin[89]* *-*-darwin10* } } } 0 } +// { dg-error "-:failed (exec|CreateProcess).*mapper.* .*this-will-not-work" "" { target { ! { *-*-darwin[89]* *-*-darwin10* } } } 0 } // { dg-prune-output "fatal error:" } // { dg-prune-output "failed to read" } // { dg-prune-output "compilation terminated" }
Re: [PATCH] testsuite: Windows paths use \ and not /
Hi, I'm really sorry for the mess. I did test my patch, but I just looked for the PASS/FAIL for the excess errors and missed that there was an error with the pattern. In the end, the patch that you pushed is much better. Thanks for fixing the issue in my absence. Kind regards, Torbjörn On 2022-09-30 23:07, Jonathan Wakely wrote: On Fri, 30 Sept 2022 at 19:13, Jonathan Wakely via Libstdc++ wrote: On Fri, 30 Sept 2022 at 19:07, Jonathan Wakely wrote: On Fri, 30 Sept 2022 at 19:04, Jonathan Wakely wrote: On Fri, 30 Sept 2022 at 18:55, Jakub Jelinek wrote: On Fri, Sep 30, 2022 at 06:47:07PM +0100, Jonathan Wakely via Gcc-patches wrote: On Fri, 30 Sept 2022 at 17:26, Jonathan Wakely wrote: On Fri, 30 Sept 2022 at 17:04, Torbjörn SVENSSON wrote: libstdc++-v3/testsuite: * 20_util/bind/ref_neg.cc: Prune Windows paths too. Please CC the libstdc++ for libstdc++ patches. OK for trunk, thanks. I'm seeing errors now on x86_64-linux: ERROR: 20_util/bind/ref_neg.cc: unknown dg option: /\\ for " dg-prune-output 53 "[/\\](functional|bits/invoke.h):" " ERROR: 20_util/bind/ref_neg.cc: unknown dg option: /\\ for " dg-prune-output 53 "[/\\](functional|bits/invoke.h):" " Bet it should be // { dg-prune-output "\[/\\](functional|bits\[/\\]invoke.h):" } or so. Completely untested. That fixes the error, but now the regex doesn't match so there are still excess errors. It needs to be: // { dg-prune-output ".*\[/\\](functional|bits\[/\\]invoke.h):.*" } Without any regex special characters, there's an implicit .* before and after the pattern. But when you use any regex special characters in the pattern, it stops working. I can't remember why. I figured it out once. It looks like just adding .* at the start is enough: // { dg-prune-output ".*\[/\\](functional|bits\[/\\]invoke.h):" } But that's so ugly, I'm tempted to replace that prune with something different. I'll finish testing this and push it. I committed this instead, with no .* in the pattern.
Re: PING^1 [PATCH] testsuite: 'b' instruction can't do long enough jumps
Hi Christophe! On 2022-09-28 13:55, Christophe Lyon wrote: Hi! On 9/28/22 11:17, Torbjorn SVENSSON via Gcc-patches wrote: Hi, Ping: https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601829.html Kind regards, Torbjörn On 2022-09-19 18:30, Torbjörn SVENSSON wrote: After moving the testglue in commit 9d503515cee, the jump to exit and abort is too far for the 'b' instruction on Cortex-M0. As most of the I am not sure I understand why that commit changed the distance between 'exit' and the branch instruction? The change was that the gcc_tg.o (the DejaGNU testglue.c object file) is now put last on the command line. In the previous versions of GCC, it was put before the ldflags flag etc, so now the code is placed in a way that the distance might be too big. This could also be related to that we in ST are using QEMU in system mode and not user mode and as a result, our test environment is slightly larger and might perhaps be placed in between the code for the test case and the testglue. C code would generate a 'bl' instruction instead of a 'b' instruction, lets do the same for the inline assembler. The error seen without this patch: /tmp/cccCRiCl.o: in function `main': stack-protector-1.c:(.text+0x4e): relocation truncated to fit: R_ARM_THM_JUMP11 against symbol `__wrap_exit' defined in .text section in gcc_tg.o stack-protector-1.c:(.text+0x50): relocation truncated to fit: R_ARM_THM_JUMP11 against symbol `__wrap_abort' defined in .text section in gcc_tg.o collect2: error: ld returned 1 exit status Anyway the change seems sensible to me, I suppose it's not worth adding support in the linker to insert long branch stubs for these relocations. If a simple 'bl' instead of 'b' is enough, I think that this trivial change is the right one as the test case is supposed to test the stack protection, not branching, right? Kind regards, Torbjörn Christophe gcc/testsuite/ChangeLog: * gcc/testsuite/gcc.target/arm/stack-protector-1.c: Use 'bl' instead of 'b' instruction. * gcc/testsuite/gcc.target/arm/stack-protector-3.c: Likewise. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/gcc.target/arm/stack-protector-1.c | 4 ++-- gcc/testsuite/gcc.target/arm/stack-protector-3.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-1.c b/gcc/testsuite/gcc.target/arm/stack-protector-1.c index 8d28b0a847c..3f0ffc9c3f3 100644 --- a/gcc/testsuite/gcc.target/arm/stack-protector-1.c +++ b/gcc/testsuite/gcc.target/arm/stack-protector-1.c @@ -56,8 +56,8 @@ asm ( " ldr r1, [sp, #4]\n" CHECK (r1) " mov r0, #0\n" -" b exit\n" +" bl exit\n" "1:\n" -" b abort\n" +" bl abort\n" " .size main, .-main" ); diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-3.c b/gcc/testsuite/gcc.target/arm/stack-protector-3.c index b8f77fa2309..2f710529b8f 100644 --- a/gcc/testsuite/gcc.target/arm/stack-protector-3.c +++ b/gcc/testsuite/gcc.target/arm/stack-protector-3.c @@ -26,7 +26,7 @@ asm ( " .type __stack_chk_fail, %function\n" "__stack_chk_fail:\n" " movs r0, #0\n" -" b exit\n" +" bl exit\n" " .size __stack_chk_fail, .-__stack_chk_fail" );
PING^1 [PATCH] testsuite: Do not prefix linker script with "-Wl,"
Hi, Ping: https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601831.html Kind regards, Torbjörn On 2022-09-19 18:57, Torbjörn SVENSSON wrote: The linker script should not be prefixed with "-Wl," - it's not an input file and does not interfere with the new dump output filename strategy. gcc/testsuite/ChangeLog: * lib/gcc-defs.exp: Do not prefix linker script with "-Wl,". Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/lib/gcc-defs.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp index 42ef1d85432..2102ed6f7a3 100644 --- a/gcc/testsuite/lib/gcc-defs.exp +++ b/gcc/testsuite/lib/gcc-defs.exp @@ -332,7 +332,7 @@ proc gcc_adjust_linker_flags_list { args } { continue } elseif { $skip != "" } then { set skip "" - } elseif { $opt == "-Xlinker" } then { + } elseif { $opt == "-Xlinker" || $opt == "-T" } then { set skip $opt } elseif { ![string match "-*" $opt] \ && [file isfile $opt] } {
PING^1 [PATCH] testsuite: 'b' instruction can't do long enough jumps
Hi, Ping: https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601829.html Kind regards, Torbjörn On 2022-09-19 18:30, Torbjörn SVENSSON wrote: After moving the testglue in commit 9d503515cee, the jump to exit and abort is too far for the 'b' instruction on Cortex-M0. As most of the C code would generate a 'bl' instruction instead of a 'b' instruction, lets do the same for the inline assembler. The error seen without this patch: /tmp/cccCRiCl.o: in function `main': stack-protector-1.c:(.text+0x4e): relocation truncated to fit: R_ARM_THM_JUMP11 against symbol `__wrap_exit' defined in .text section in gcc_tg.o stack-protector-1.c:(.text+0x50): relocation truncated to fit: R_ARM_THM_JUMP11 against symbol `__wrap_abort' defined in .text section in gcc_tg.o collect2: error: ld returned 1 exit status gcc/testsuite/ChangeLog: * gcc/testsuite/gcc.target/arm/stack-protector-1.c: Use 'bl' instead of 'b' instruction. * gcc/testsuite/gcc.target/arm/stack-protector-3.c: Likewise. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/gcc.target/arm/stack-protector-1.c | 4 ++-- gcc/testsuite/gcc.target/arm/stack-protector-3.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-1.c b/gcc/testsuite/gcc.target/arm/stack-protector-1.c index 8d28b0a847c..3f0ffc9c3f3 100644 --- a/gcc/testsuite/gcc.target/arm/stack-protector-1.c +++ b/gcc/testsuite/gcc.target/arm/stack-protector-1.c @@ -56,8 +56,8 @@ asm ( "ldr r1, [sp, #4]\n" CHECK (r1) "mov r0, #0\n" -" b exit\n" +" bl exit\n" "1:\n" -" b abort\n" +" bl abort\n" ".size main, .-main" ); diff --git a/gcc/testsuite/gcc.target/arm/stack-protector-3.c b/gcc/testsuite/gcc.target/arm/stack-protector-3.c index b8f77fa2309..2f710529b8f 100644 --- a/gcc/testsuite/gcc.target/arm/stack-protector-3.c +++ b/gcc/testsuite/gcc.target/arm/stack-protector-3.c @@ -26,7 +26,7 @@ asm ( ".type __stack_chk_fail, %function\n" "__stack_chk_fail:\n" "movsr0, #0\n" -" b exit\n" +" bl exit\n" ".size __stack_chk_fail, .-__stack_chk_fail" );
Re: [PATCH v2] testsuite: Only run test on target if VMA == LMA
Hi Richard, Thanks for your review. Comments below. On 2022-09-23 19:34, Richard Sandiford wrote: Torbjörn SVENSSON via Gcc-patches writes: Checking that the triplet matches arm*-*-eabi (or msp430-*-*) is not enough to know if the execution will enter an endless loop, or if it will give a meaningful result. As the execution test only work when VMA and LMA are equal, make sure that this condition is met. 2022-09-16 Torbjörn SVENSSON gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_vma_equals_lma): New. * c-c++-common/torture/attr-noinit-1.c: Requre VMA == LMA to run. * c-c++-common/torture/attr-noinit-2.c: Likewise. * c-c++-common/torture/attr-noinit-3.c: Likewise. * c-c++-common/torture/attr-persistent-1.c: Likewise. * c-c++-common/torture/attr-persistent-3.c: Likewise. Looks like a nice thing to have. Could you add an entry to doc/sourcebuild.texi too? I've added a note and will be shared in a v3. + +# Example output of objdump: +#vma_equals_lma9059.exe: file format elf32-littlearm +# +#Sections: +#Idx Name Size VMA LMA File off Algn +# 6 .data 0558 2000 08002658 0002 2**3 +# CONTENTS, ALLOC, LOAD, DATA + +# Capture LMA and VMA columns for .data section +if ![ regexp "\d*\d+\s+\.data\s+\d+\s+(\d+)\s+(\d+)" $output dummy vma lma ] { Maybe my Tcl is getting rusty, but I'm surprised this quoting works. I'd have expected single backslashes to be interpreted as C-style sequences (for \n etc) and so be eaten before regexp sees them. Quoting with {...} instead of "..." would avoid that. Good catch! I'm not fluent in Tcl and apparently, I was not testing this well enough before sending it to the list. I got the expected result for the test cases, but for the wrong reason. I've correct it for the v3. +verbose "Could not parse objdump output" 2 +return 0 +} else { +return [string equal $vma $lma] +} + } else { +remote_file build delete $exe +verbose "Could not determine if VMA is equal to LMA. Assuming not equal." 2 +return 0 + } Would it be more conservative to return 1 on failure rather than 0? That way, a faulty test would trigger XFAILs rather than UNSUPPORTEDs, with XFAILs being more likely to get attention. The main issue here is that for targets where VMA != LMA, executing the tests will fall into an endless recursion loop. Well, "endless" in the sense that the stack might be depleted or the test will simply timeout. The test cases are designed to assume that it's safe to call _start() from within main() to verify that the state of some variables tagged with certain attributes are correct after a "reset". On the other hand, I suppose we don't lose much if these tests are run on common targets only. So either way is OK, just asking. ;-) Do you think it's worth to have these tests reach the timeout to have them in the XFAIL list rather than in the UNSUPPORTED list? Keep in mind that it's not just one test case, it's 5 test cases times the number of permutations of the CFLAGS... It's also not expected that these test cases will be changed in a way that will make them work when VMA != LMA. Kind regards, Torbjörn
Re: [PATCH] testsuite: Sanitize fails for SP FPU on Arm
Hi Joseph, On 2022-09-23 00:42, Joseph Myers wrote: On Thu, 22 Sep 2022, Torbjörn SVENSSON via Gcc-patches wrote: This patch stops reporting fails for Arm targets with single precision floating point unit for types wider than 32 bits (the width of float on arm-none-eabi). As reported in PR102017, fenv is reported as supported in recent versions of newlib. At the same time, for some Arm targets, the implementation in libgcc does not support exceptions and thus, the test fails with a call to abort(). It's definitely wrong to have this sort of Arm-specific conditional in architecture-independent tests. Tests requiring floating-point exceptions support should have an appropriate dg-require-effective-target; if that dg-require-effective-target wrongly passes in certain configurations, fix it (or e.g. add a new check_effective_target_fenv_exceptions_double to verify that exceptions work for double, as opposed to the present check_effective_target_fenv_exceptions which checks whether exceptions work for float, and then adjust tests requiring exceptions for double to use the new effective-target). Okay, thanks for your review. I will split this test case into 3 files as for SP FPU, we would like to verify that the exception handling for the float part work, but at the same time we know that exception handling for double and long double should not work. Do you think it's preferable to have the double and long double should be reported as UNSUPPORRTED, or as XFAIL for the SP FPU case?
Re: [PATCH] testsuite: Disable zero-scratch-regs-{7, 9, 11}.c on arm
Hi all, Appears that this is just a problem for gcc11 (and perhaps gcc12?). Master already has the needed implementation, so the patch below is not needed. Sorry for the buzz. Kind regards, Torbjörn On 2022-09-15 08:54, Torbjörn SVENSSON wrote: -fzero-call-used-regs=all and -fzero-call-used-regs=all-gpr are not supported on arm*. On arm-none-eabi, the testcases fails with: sorry, unimplemented: '-fzero-call-used-regs' not supported on this target 2022-09-15 Torbjörn SVENSSON gcc/testsuite/ChangeLog: * c-c++-common/zero-scratch-regs-7.c: Skip on arm. * c-c++-common/zero-scratch-regs-9.c: Likewise. * c-c++-common/zero-scratch-regs-11.c: Likewise. Co-Authored-By: Yvan ROUX Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/c-c++-common/zero-scratch-regs-11.c | 2 +- gcc/testsuite/c-c++-common/zero-scratch-regs-7.c | 1 + gcc/testsuite/c-c++-common/zero-scratch-regs-9.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c index b7739b2c6f6..6fd2a1dc382 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-11.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* s390*-*-* loongarch64*-*-* } } } */ +/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* nvptx*-*-* s390*-*-* loongarch64*-*-* } } } */ /* { dg-options "-O2 -fzero-call-used-regs=all" } */ #include "zero-scratch-regs-10.c" diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c index 2a4c8b2e73d..c684b4a02f9 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-7.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-skip-if "not implemented" { ia64*-*-* } } */ +/* { dg-skip-if "not implemented" { arm*-*-* } } */ /* { dg-options "-O2 -fzero-call-used-regs=all-gpr" } */ #include "zero-scratch-regs-1.c" diff --git a/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c b/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c index ea83bc146b7..0e8922053e8 100644 --- a/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c +++ b/gcc/testsuite/c-c++-common/zero-scratch-regs-9.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* arm*-*-* nvptx*-*-* s390*-*-* loongarch64*-*-* } } } */ +/* { dg-skip-if "not implemented" { ! { i?86*-*-* x86_64*-*-* sparc*-*-* aarch64*-*-* nvptx*-*-* s390*-*-* loongarch64*-*-* } } } */ /* { dg-options "-O2 -fzero-call-used-regs=all" } */ #include "zero-scratch-regs-1.c"
Re: [PATCH v2] gcov: Respect triplet when looking for gcov
On 2022-09-12 10:40, Martin Liška wrote: On 9/12/22 09:06, Torbjorn SVENSSON via Gcc-patches wrote: On 2022-09-11 21:38, Mikael Morin wrote: Le 11/09/2022 à 18:04, Torbjorn SVENSSON a écrit : Can you fix it for me and submit it or do you want me to send a v3? For trivial things like this, there is no need for a v3 (nor was there for a v2). Do you miss a git write account and need someone to push for you? Ok! I do not have any write access, so yes, please push it for me! Please attach a patch with git format-patch and I'm going to push it now. Cheers, Martin Patch attached as requested.From 0400f4b34a62ad5a54e87c537b4a41bc630fd105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= Date: Fri, 9 Sep 2022 12:19:27 +0200 Subject: [PATCH] gcov: Respect triplet when looking for gcov MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When testing a cross toolchain outside the build tree, the binary name for gcov is prefixed with the triplet. gcc/testsuite/ChangeLog: * g++.dg/gcov/gcov.exp: Respect triplet when looking for gcov. * gcc.misc-tests/gcov.exp: Likewise. Signed-off-by: Torbjörn SVENSSON --- gcc/testsuite/g++.dg/gcov/gcov.exp| 4 ++-- gcc/testsuite/gcc.misc-tests/gcov.exp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/g++.dg/gcov/gcov.exp b/gcc/testsuite/g++.dg/gcov/gcov.exp index 88acd95c361..04e7a016486 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov.exp +++ b/gcc/testsuite/g++.dg/gcov/gcov.exp @@ -24,9 +24,9 @@ global GXX_UNDER_TEST # Find gcov in the same directory as $GXX_UNDER_TEST. if { ![is_remote host] && [string match "*/*" [lindex $GXX_UNDER_TEST 0]] } { -set GCOV [file dirname [lindex $GXX_UNDER_TEST 0]]/gcov +set GCOV [file dirname [lindex $GXX_UNDER_TEST 0]]/[transform gcov] } else { -set GCOV gcov +set GCOV [transform gcov] } # Initialize harness. diff --git a/gcc/testsuite/gcc.misc-tests/gcov.exp b/gcc/testsuite/gcc.misc-tests/gcov.exp index 82376d90ac2..b8e9661aa53 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov.exp +++ b/gcc/testsuite/gcc.misc-tests/gcov.exp @@ -24,9 +24,9 @@ global GCC_UNDER_TEST # For now find gcov in the same directory as $GCC_UNDER_TEST. if { ![is_remote host] && [string match "*/*" [lindex $GCC_UNDER_TEST 0]] } { -set GCOV [file dirname [lindex $GCC_UNDER_TEST 0]]/gcov +set GCOV [file dirname [lindex $GCC_UNDER_TEST 0]]/[transform gcov] } else { -set GCOV gcov +set GCOV [transform gcov] } # Initialize harness. -- 2.25.1
Re: [PATCH v2] gcov: Respect triplet when looking for gcov
On 2022-09-11 21:38, Mikael Morin wrote: Le 11/09/2022 à 18:04, Torbjorn SVENSSON a écrit : Can you fix it for me and submit it or do you want me to send a v3? For trivial things like this, there is no need for a v3 (nor was there for a v2). Do you miss a git write account and need someone to push for you? Ok! I do not have any write access, so yes, please push it for me!
Re: [PATCH v2] gcov: Respect triplet when looking for gcov
Hi, On 2022-09-11 16:34, Mikael Morin wrote: Hello, diff --git a/gcc/testsuite/gcc.misc-tests/gcov.exp b/gcc/testsuite/gcc.misc-tests/gcov.exp index 82376d90ac2..a55ce234f6e 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov.exp +++ b/gcc/testsuite/gcc.misc-tests/gcov.exp @@ -24,9 +24,9 @@ global GCC_UNDER_TEST (...) } else { - set GCOV gcov + set GCOV {transform gcov] Typo: I guess the opening curly bracket '{' should be a square one '['? Yes. Apparently I was too stressed when preparing this patch. Can you fix it for me and submit it or do you want me to send a v3?