public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/115404] New: [15 Regression] possibly wrong code on glibc-2.39 since r15-1113-gde05e44b2ad963
@ 2024-06-09 10:40 slyfox at gcc dot gnu.org
  2024-06-09 11:00 ` [Bug target/115404] " ubizjak at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: slyfox at gcc dot gnu.org @ 2024-06-09 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115404
           Summary: [15 Regression] possibly wrong code on glibc-2.39
                    since r15-1113-gde05e44b2ad963
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

No minimal reproducer yet, filing in case it's an easy to notice bug from the
bisected r15-1113-gde05e44b2ad963:

  commit de05e44b2ad9638d04173393b1eae3c38b2c3864
  Author: Uros Bizjak <ubizjak@gmail.com>
  Date:   Sat Jun 8 12:17:11 2024 +0200

    i386: Implement .SAT_ADD for unsigned scalar integers [PR112600]

    ...

The bug manifests as a testsuite failure on mpfr-4.2.1 as:

  FAIL: tsprintf
  ==============

  Fatal glibc error: printf_buffer_as_file.c:31
(__printf_buffer_as_file_commit): assertion failed: file->stream._IO_write_ptr
<= file->next->write_end
  FAIL tsprintf (exit status: 134)

I think it's a `file->next->write_end` corruption around this code in glibc's
libio/iovsprintf.c:

```c
int
__vsprintf_internal (char *string, size_t maxlen,
                     const char *format, va_list args,
                     unsigned int mode_flags)
{
  struct __printf_buffer buf;

  if ((mode_flags & PRINTF_CHK) != 0)
    {
      string[0] = '\0';
      uintptr_t end;
      if (__builtin_add_overflow ((uintptr_t) string, maxlen, &end))
        end = -1;
      __printf_buffer_init_end (&buf, string, (char *) end,
                            __printf_buffer_mode_sprintf_chk);
    }
   ...
```

Could it be that dead store to `&end` somehow conflicts with a following `end =
-1`?

I'll try to extract self-contained example, but it will take some time.

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

end of thread, other threads:[~2024-06-16 21:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-09 10:40 [Bug target/115404] New: [15 Regression] possibly wrong code on glibc-2.39 since r15-1113-gde05e44b2ad963 slyfox at gcc dot gnu.org
2024-06-09 11:00 ` [Bug target/115404] " ubizjak at gmail dot com
2024-06-09 22:04 ` slyfox at gcc dot gnu.org
2024-06-10  6:07 ` ubizjak at gmail dot com
2024-06-10  6:42 ` rguenth at gcc dot gnu.org
2024-06-10  7:47 ` [Bug tree-optimization/115404] " ubizjak at gmail dot com
2024-06-10  7:53 ` pinskia at gcc dot gnu.org
2024-06-10 21:51 ` slyfox at gcc dot gnu.org
2024-06-16 21:33 ` law 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).