[Bug ipa/111613] [12/13/14/15 Regression] Bit field stores can be incorrectly optimized away when -fstore-merging is in effect since r12-5383-g22c242342e38eb

hubicka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 22 16:19:36 GMT 2024


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

--- Comment #7 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
I suppose there is not much to do about past noread flags. I do not see how
optimization can invalidate other properties, so I am testing the following:

diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc
index f994388a96a..53a2e35133d 100644
--- a/gcc/ipa-modref.cc
+++ b/gcc/ipa-modref.cc
@@ -3004,6 +3004,9 @@ analyze_parms (modref_summary *summary,
modref_summary_lto *summary_lto,
                     (past, ecf_flags,
                      VOID_TYPE_P (TREE_TYPE
                          (TREE_TYPE (current_function_decl))));
+         /* Store merging can produce reads when combining together multiple
+            bitfields.  See PR111613.  */
+         past &= ~(EAF_NO_DIRECT_READ | EAF_NO_INDIRECT_READ);
          if (dump_file && (flags | past) != flags && !(flags & EAF_UNUSED))
            {
              fprintf (dump_file,


More information about the Gcc-bugs mailing list