public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/109350] New: FAIL: g++.dg/warn/Wstringop-overflow-4.C
@ 2023-03-31  6:09 rguenth at gcc dot gnu.org
  2023-03-31  6:35 ` [Bug tree-optimization/109350] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-31  6:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109350
           Summary: FAIL: g++.dg/warn/Wstringop-overflow-4.C
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

The

  T (S (2), new int16_t[r_imin_imax + 1]); // { dg-bogus "into a region of
size" "pr106120" { xfail { ilp32 && c++98_only } } }

subtest now FAILs.

Reduced testcase:

#include "../../gcc.dg/range.h"

#define INT_MAX     __INT_MAX__
#define INT_MIN     (-INT_MAX - 1)

extern "C" char* strcpy (char*, const char*);

void sink (void*);

#define S36 "0123456789abcdefghijklmnopqrstuvwxyz"
#define S(N) (S36 + sizeof S36 - N - 1)

#define T(src, alloc) do {                      \
    const char *s = src;                        \
    char *d = (char*)alloc;                     \
    strcpy (d, s);                              \
    sink (d);                                   \
  } while (0)


#ifdef __INT16_TYPE__

// Hack around PR 92829.
#define XUR(min, max) \
  (++idx, (vals[idx] < min || max < vals[idx] ? min : vals[idx]))

typedef __INT16_TYPE__ int16_t;

void test_strcpy_new_int16_t (size_t n, const size_t vals[])
{
  size_t idx = 0;

  int r_imin_imax = SR (INT_MIN, INT_MAX);
  T (S (1), new int16_t[r_imin_imax]);
  T (S (2), new int16_t[r_imin_imax + 1]); // { dg-bogus "into a region of
size" "pr106120" { xfail { ilp32 && c++98_only } } }
  T (S (9), new int16_t[r_imin_imax * 2 + 1]);

}

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

end of thread, other threads:[~2023-03-31 20:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31  6:09 [Bug tree-optimization/109350] New: FAIL: g++.dg/warn/Wstringop-overflow-4.C rguenth at gcc dot gnu.org
2023-03-31  6:35 ` [Bug tree-optimization/109350] " rguenth at gcc dot gnu.org
2023-03-31  7:17 ` rguenth at gcc dot gnu.org
2023-03-31 14:30 ` amacleod at redhat dot com
2023-03-31 20:47 ` amacleod at redhat dot com

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).