[Bug tree-optimization/101419] [9/10/11/12 Regression] collapsing memset() calls can break __builtin_object_size()
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 12 11:21:24 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101419
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/tree-pass.h.jj 2021-01-27 10:10:00.525903635 +0100
+++ gcc/tree-pass.h 2021-07-12 13:10:59.621933276 +0200
@@ -208,6 +208,7 @@ protected:
#define PROP_gimple_lcf (1 << 1) /* lowered control flow
*/
#define PROP_gimple_leh (1 << 2) /* lowered eh */
#define PROP_cfg (1 << 3)
+#define PROP_objsz (1 << 4) /* object sizes computed */
#define PROP_ssa (1 << 5)
#define PROP_no_crit_edges (1 << 6)
#define PROP_rtl (1 << 7)
--- gcc/tree-object-size.c.jj 2021-01-04 10:25:39.911221618 +0100
+++ gcc/tree-object-size.c 2021-07-12 13:19:50.021568629 +0200
@@ -1450,6 +1450,8 @@ pass_object_sizes::execute (function *fu
}
fini_object_sizes ();
+ if (!insert_min_max_p)
+ fun->curr_properties |= PROP_objsz;
return 0;
}
--- gcc/tree-ssa-sccvn.c.jj 2021-06-09 10:20:08.988342285 +0200
+++ gcc/tree-ssa-sccvn.c 2021-07-12 13:14:33.482962387 +0200
@@ -925,12 +925,10 @@ copy_reference_ops_from_ref (tree ref, v
+ (wi::to_offset (bit_offset) >> LOG2_BITS_PER_UNIT));
/* Probibit value-numbering zero offset components
of addresses the same before the pass folding
- __builtin_object_size had a chance to run
- (checking cfun->after_inlining does the
- trick here). */
+ __builtin_object_size had a chance to run. */
if (TREE_CODE (orig) != ADDR_EXPR
|| maybe_ne (off, 0)
- || cfun->after_inlining)
+ || (cfun->curr_properties & PROP_objsz))
off.to_shwi (&temp.off);
}
}
seems to work for both testcases.
More information about the Gcc-bugs
mailing list