public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5649] tree-optimization/103456 - Record only successes from object_sizes_set
@ 2021-12-01 8:31 Siddhesh Poyarekar
0 siblings, 0 replies; only message in thread
From: Siddhesh Poyarekar @ 2021-12-01 8:31 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:da9386f9a70ac494939650c0e0a0e4168a6f76d8
commit r12-5649-gda9386f9a70ac494939650c0e0a0e4168a6f76d8
Author: Siddhesh Poyarekar <siddhesh@gotplt.org>
Date: Wed Dec 1 12:58:12 2021 +0530
tree-optimization/103456 - Record only successes from object_sizes_set
Avoid overwriting osi->changed if object_sizes_set does not update the
size, so that a previous success in the same pass is not overwritten.
This fixes the bootstrap-ubsan build config, which was failing due to
incorrect object size.
gcc/ChangeLog:
PR tree-optimization/103456
* tree-object-size.c (merge_object_sizes): Update osi->changed
only if object_sizes_set succeeded.
gcc/testsuite/ChangeLog:
PR tree-optimization/103456
* gcc.dg/ubsan/pr103456.c: New test.
Co-authored-by: Martin Liška <mliska@suse.cz>
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
Diff:
---
gcc/testsuite/gcc.dg/ubsan/pr103456.c | 21 +++++++++++++++++++++
gcc/tree-object-size.c | 3 ++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/gcc/testsuite/gcc.dg/ubsan/pr103456.c b/gcc/testsuite/gcc.dg/ubsan/pr103456.c
new file mode 100644
index 00000000000..20322fbaab1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ubsan/pr103456.c
@@ -0,0 +1,21 @@
+/* PR tree-optimization/103456 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined -O -fdump-tree-objsz" } */
+
+static char *multilib_options = "m64/m32";
+
+void
+used_arg_t (void)
+{
+ char *q = multilib_options;
+ for (;;)
+ {
+ while (*q)
+ q++;
+ while (__builtin_strchr (q, '_') == 0)
+ while (*q)
+ q++;
+ }
+}
+
+/* { dg-final { scan-tree-dump-not "maximum object size 0" "objsz1" } } */
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 3780437ff91..b4881ef198f 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -854,7 +854,8 @@ merge_object_sizes (struct object_size_info *osi, tree dest, tree orig,
orig_bytes = (offset > orig_bytes)
? HOST_WIDE_INT_0U : orig_bytes - offset;
- osi->changed = object_sizes_set (osi, varno, orig_bytes);
+ if (object_sizes_set (osi, varno, orig_bytes))
+ osi->changed = true;
return bitmap_bit_p (osi->reexamine, SSA_NAME_VERSION (orig));
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-01 8:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01 8:31 [gcc r12-5649] tree-optimization/103456 - Record only successes from object_sizes_set Siddhesh Poyarekar
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).