public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/97006] New: [nvptx] FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test
@ 2020-09-10  9:39 vries at gcc dot gnu.org
  2020-09-10 11:15 ` [Bug target/97006] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-10  9:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97006

            Bug ID: 97006
           Summary: [nvptx] FAIL: gcc.dg/tree-ssa/builtin-sprintf.c
                    execution test
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

First sign of trouble:
...
FAIL: test_d_i:291: "%hhi" expected result for "-16657" doesn't match function
call return value: 6 not in [1, 4]^M
...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/97006] [nvptx] FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test
  2020-09-10  9:39 [Bug target/97006] New: [nvptx] FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test vries at gcc dot gnu.org
@ 2020-09-10 11:15 ` vries at gcc dot gnu.org
  2022-02-07 12:46 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2020-09-10 11:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97006

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Minimal example:
...
void __attribute__ ((noclone, noinline))
checkv (char *dst, const char *fmt, __builtin_va_list va)
{
  int n = __builtin_vsprintf (dst, fmt, va);
  if (n != 3)
    __builtin_abort ();
}

void __attribute__ ((noclone, noinline))
check (char *dst, const char *fmt, ...)
{
  __builtin_va_list va;
  __builtin_va_start (va, fmt);
  checkv (dst, fmt, va);
  __builtin_va_end (va);
}

char buffer[4100];

int
main (void)
{
  int i = 0xdeadbeef;
  check (buffer, "%hhi", i);

  return 0;
}
...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/97006] [nvptx] FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test
  2020-09-10  9:39 [Bug target/97006] New: [nvptx] FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test vries at gcc dot gnu.org
  2020-09-10 11:15 ` [Bug target/97006] " vries at gcc dot gnu.org
@ 2022-02-07 12:46 ` vries at gcc dot gnu.org
  2022-02-07 13:06 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-02-07 12:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97006

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
With -fno-builtin, mimimized further to:
...
char buffer[100];

int
main (void)
{
  unsigned int i = 0xdeadbeef;

  __builtin_sprintf (buffer, "%hhx", i);
  __builtin_printf ("%s\n", buffer);

  __builtin_printf ("%hhx\n", i);

  return 0;
}
...

On x86_64 with glibc:
...
$ gcc gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf.c
$ ./a.out
ef
ef
...

On nvptx with newlib:
...
spawn nvptx-none-run ./builtin-sprintf.exe^M
beef^M
%hhx^M
...

This could be related to newlib support for hh, I'll try to rebuild with
--enable-newlib-io-c99-formats.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/97006] [nvptx] FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test
  2020-09-10  9:39 [Bug target/97006] New: [nvptx] FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test vries at gcc dot gnu.org
  2020-09-10 11:15 ` [Bug target/97006] " vries at gcc dot gnu.org
  2022-02-07 12:46 ` vries at gcc dot gnu.org
@ 2022-02-07 13:06 ` vries at gcc dot gnu.org
  2022-02-07 13:44 ` vries at gcc dot gnu.org
  2022-02-08  9:05 ` [Bug testsuite/97006] " vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-02-07 13:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97006

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> I'll try to rebuild with
> --enable-newlib-io-c99-formats.

And we run into:
...
In file included from
/home/vries/nvptx/trunk/source-gcc/newlib/libc/include/stdlib.h:22,
                 from
/home/vries/nvptx/trunk/source-gcc/newlib/libc/stdio/vfscanf.c:83:
/home/vries/nvptx/trunk/source-gcc/newlib/libc/stdio/vfscanf.c: In function
‘__ssvfiscanf_r’:
/home/vries/nvptx/trunk/source-gcc/newlib/libc/stdio/vfscanf.c:451:39: sorry,
unimplemented: \
target cannot support alloca
...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/97006] [nvptx] FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test
  2020-09-10  9:39 [Bug target/97006] New: [nvptx] FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-02-07 13:06 ` vries at gcc dot gnu.org
@ 2022-02-07 13:44 ` vries at gcc dot gnu.org
  2022-02-08  9:05 ` [Bug testsuite/97006] " vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-02-07 13:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97006

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
This fixes it:
...
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf.c
b/gcc/testsuite/gcc.dg/tree-ss
a/builtin-sprintf.c
index f90558e9b7ee..9368a2e0e50a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf.c
@@ -3,7 +3,8 @@
    constant folding.  With optimization enabled the test will fail to
    link if any of the assertions fails.  Without optimization the test
    aborts at runtime if any of the assertions fails.  */
-/* { dg-do run } */
+/* { dg-do run { target c99_runtime } } */
+/* { dg-do link { target { ! c99_runtime } } } */
 /* { dg-skip-if "not IEEE float layout" { "pdp11-*-*" } } */
 /* { dg-additional-options "-O2 -Wall -Wno-pedantic -fprintf-return-value" }
*/
...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug testsuite/97006] [nvptx] FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test
  2020-09-10  9:39 [Bug target/97006] New: [nvptx] FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-02-07 13:44 ` vries at gcc dot gnu.org
@ 2022-02-08  9:05 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2022-02-08  9:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97006

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
          Component|target                      |testsuite
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed in
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=f05cc4fd6f0f52b8629ed6f7c068b5b2de7fa627

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-08  9:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10  9:39 [Bug target/97006] New: [nvptx] FAIL: gcc.dg/tree-ssa/builtin-sprintf.c execution test vries at gcc dot gnu.org
2020-09-10 11:15 ` [Bug target/97006] " vries at gcc dot gnu.org
2022-02-07 12:46 ` vries at gcc dot gnu.org
2022-02-07 13:06 ` vries at gcc dot gnu.org
2022-02-07 13:44 ` vries at gcc dot gnu.org
2022-02-08  9:05 ` [Bug testsuite/97006] " vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).