]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
nvptx: Disable effective-target 'freestanding'
authorThomas Schwinge <thomas@codesourcery.com>
Mon, 28 Nov 2022 12:49:06 +0000 (13:49 +0100)
committerThomas Schwinge <tschwinge@baylibre.com>
Mon, 7 Oct 2024 08:13:11 +0000 (10:13 +0200)
After 2014's commit 157e859ffe3b5d43db1e19475711c1a3d21ab57a "remove picochip",
the effective-target 'freestanding' (later) was only ever used for nvptx.
However, the relevant I/O library functions have long been implemented in nvptx
newlib.

These test cases generally PASS, just a few need to get XFAILed; see
<https://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability/#system-calls>,
and then supposedly
<https://docs.nvidia.com/cuda/cuda-c-programming-guide/#formatted-output> for
description of the non-standard PTX 'vprintf' return value:

> Unlike the C-standard 'printf()', which returns the number of characters
> printed, CUDA's 'printf()' returns the number of arguments parsed. If no
> arguments follow the format string, 0 is returned. If the format string is
> NULL, -1 is returned. If an internal error occurs, -2 is returned.

(I've tried a few variants to confirm that PTX 'vprintf' -- which supposedly is
underlying the CUDA 'printf' -- is what's implementing this behavior.)
Probably, we ought to fix that up in nvptx newlib.

gcc/testsuite/
* gcc.c-torture/execute/printf-1.c: XFAIL for nvptx.
* gcc.c-torture/execute/printf-chk-1.c: Likewise.
* gcc.c-torture/execute/vprintf-1.c: Likewise.
* gcc.c-torture/execute/vprintf-chk-1.c: Likewise.
* lib/target-supports.exp (check_effective_target_freestanding):
Disable for nvptx.

gcc/testsuite/gcc.c-torture/execute/printf-1.c
gcc/testsuite/gcc.c-torture/execute/printf-chk-1.c
gcc/testsuite/gcc.c-torture/execute/vprintf-1.c
gcc/testsuite/gcc.c-torture/execute/vprintf-chk-1.c
gcc/testsuite/lib/target-supports.exp

index 654e62766a85e879a3c0a3920788a3845415d1db..e1201365c1f505b711717c4c4ed0ca9582949319 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-skip-if "requires io" { freestanding } }  */
+/* { dg-xfail-run-if {unexpected PTX 'vprintf' return value} { nvptx-*-* } } */
 
 #include <stdio.h>
 #include <stdlib.h>
index aab43062baefd164c5d495a23f629983d199c45e..6418957edae490f2b9639c37c38b9f791f79267b 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-skip-if "requires io" { freestanding } }  */
+/* { dg-xfail-run-if {unexpected PTX 'vprintf' return value} { nvptx-*-* } } */
 
 #include <stdio.h>
 #include <stdlib.h>
index 259397ebda390bf5aef537324936c918e5cc96a4..0fb1ade94e0b2509b9a767eb911cef5e33b1b0bd 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-skip-if "requires io" { freestanding } }  */
+/* { dg-xfail-run-if {unexpected PTX 'vprintf' return value} { nvptx-*-* } } */
 
 #ifndef test
 #include <stdio.h>
index 04ecc4df4d93bbf387e4a410e1b3c23857070758..7ea3617e184c0a1bf9e1fb34a30b0bf05553cc53 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-skip-if "requires io" { freestanding } }  */
+/* { dg-xfail-run-if {unexpected PTX 'vprintf' return value} { nvptx-*-* } } */
 
 #ifndef test
 #include <stdio.h>
index 459af8e58c660eccabf20bf450045a68230dc545..1c9bbf64817a731a9fe4961897d7e640f78b66cf 100644 (file)
@@ -859,9 +859,6 @@ proc check_profiling_available { test_what } {
 # in Section 4 of C99 standard. Effectively, it is a target which supports no
 # extra headers or libraries other than what is considered essential.
 proc check_effective_target_freestanding { } {
-    if { [istarget nvptx-*-*] } {
-       return 1
-    }
     return 0
 }