public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/107561] New: g++.dg/pr17488.C regression due to -Wstringop-overflow problem
@ 2022-11-07 20:06 aldyh at gcc dot gnu.org
  2022-11-07 20:10 ` [Bug tree-optimization/107561] [13 Regression] " pinskia at gcc dot gnu.org
                   ` (28 more replies)
  0 siblings, 29 replies; 30+ messages in thread
From: aldyh at gcc dot gnu.org @ 2022-11-07 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107561
           Summary: g++.dg/pr17488.C regression due to -Wstringop-overflow
                    problem
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aldyh at gcc dot gnu.org
  Target Milestone: ---

g++.dg/pr17488.C fails after commit r13-3761 with:

warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’
writing 8 or more bytes into a region of size 0 overflows the destination
[-Wstringop-overflow=]
...
...
note: destination object of size 0 allocated by ‘operator new’

There is no difference in the IL the -Wstringop-overflow pass sees.  For
that matter, there is no difference in the entire IL across through
the *.optimized dump.  However, there are different ranges for two SSA
names.

In the *.waccess1 pass we see:

--- /tmp/a.ii.025t.waccess1.orig.787460 2022-11-07 19:43:41.341855227 +0100
+++ /tmp/a.ii.025t.waccess1.new.787460  2022-11-07 19:43:41.344855238 +0100
@@ -331,8 +331,8 @@
   max_depth:          3

 pointer_query cache contents:
-  5.0[1]: _5 = _5 (base0); size: unknown
-  6.0[3]: _6 = _5 (base0); size: unknown
+  5.0[1]: _5 = _5 (base0); size: [16, 9223372036854775807]
+  6.0[3]: _6 = _5 (base0); size: [16, 9223372036854775807]

 __attribute__((malloc))
 struct valarray * std::__valarray_get_storage<std::valarray<long long int> >
(size_t __n)
@@ -364,8 +364,8 @@
   max_depth:          3

 pointer_query cache contents:
-  5.0[1]: _5 = _5 (base0); size: unknown
-  6.0[3]: _6 = _5 (base0); size: unknown
+  5.0[1]: _5 = _5 (base0); size: [8, 9223372036854775807]
+  6.0[3]: _6 = _5 (base0); size: [8, 9223372036854775807]

 __attribute__((malloc))
 long long int * std::__valarray_get_storage<long long int> (size_t __n)

This coincides with two unsigned multiplications by 16 and 8, where we
correctly restrict the range.  This is from the evrp dump:

-Global Exported: _2 = [irange] long unsigned int [0, +INF] NONZERO
0xfffffffffffffff0
+Global Exported: _2 = [irange] long unsigned int [0, 0][16, +INF] NONZERO
0xfffffffffffffff0

-Global Exported: _2 = [irange] long unsigned int [0, +INF] NONZERO
0xfffffffffffffff8
+Global Exported: _2 = [irange] long unsigned int [0, 0][8, +INF] NONZERO
0xfffffffffffffff8

This is correct as we know the ranges cannot be [1,15] and [1,7] respectively.

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

end of thread, other threads:[~2023-03-30 11:17 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 20:06 [Bug tree-optimization/107561] New: g++.dg/pr17488.C regression due to -Wstringop-overflow problem aldyh at gcc dot gnu.org
2022-11-07 20:10 ` [Bug tree-optimization/107561] [13 Regression] " pinskia at gcc dot gnu.org
2022-11-08  8:31 ` aldyh at gcc dot gnu.org
2022-11-08  8:48 ` [Bug tree-optimization/107561] [13 Regression] g++.dg/pr17488.C and [g++.dg/warn/Warray-bounds-16.C -m32] " aldyh at gcc dot gnu.org
2022-11-08  9:34 ` rguenth at gcc dot gnu.org
2022-11-08 13:43 ` aldyh at gcc dot gnu.org
2022-11-08 18:27 ` pinskia at gcc dot gnu.org
2022-12-14 15:43 ` [Bug tree-optimization/107561] [13 Regression] g++.dg/pr71488.C " danglin at gcc dot gnu.org
2023-01-13 12:42 ` rguenth at gcc dot gnu.org
2023-02-02 18:53 ` hp at gcc dot gnu.org
2023-02-02 21:03 ` hp at gcc dot gnu.org
2023-02-10  0:42 ` cvs-commit at gcc dot gnu.org
2023-02-27  9:56 ` rguenth at gcc dot gnu.org
2023-02-27 11:18 ` rguenth at gcc dot gnu.org
2023-02-27 12:49 ` rguenth at gcc dot gnu.org
2023-02-27 13:45 ` aldyh at gcc dot gnu.org
2023-02-27 14:38 ` redi at gcc dot gnu.org
2023-02-27 16:16 ` aldyh at gcc dot gnu.org
2023-03-01 14:22 ` rguenth at gcc dot gnu.org
2023-03-01 14:34 ` jakub at gcc dot gnu.org
2023-03-01 14:38 ` rguenth at gcc dot gnu.org
2023-03-01 14:55 ` jakub at gcc dot gnu.org
2023-03-01 14:57 ` jakub at gcc dot gnu.org
2023-03-01 15:55 ` redi at gcc dot gnu.org
2023-03-02  7:51 ` rguenth at gcc dot gnu.org
2023-03-02  7:53 ` rguenth at gcc dot gnu.org
2023-03-29 11:38 ` rguenth at gcc dot gnu.org
2023-03-29 11:41 ` rguenth at gcc dot gnu.org
2023-03-30 11:16 ` cvs-commit at gcc dot gnu.org
2023-03-30 11:17 ` rguenth 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).