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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot 
gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fix:

--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -10329,6 +10329,8 @@ maybe_warn_class_memaccess (location_t loc, tree
fndecl,
      /* Finally, warn on partial copies.  */
      unsigned HOST_WIDE_INT typesize
        = tree_to_uhwi (TYPE_SIZE_UNIT (desttype));
+     if (typesize == 0)
+       break;
      if (unsigned HOST_WIDE_INT partial = tree_to_uhwi (sz) % typesize)
        warned = warning_at (loc, OPT_Wclass_memaccess,
                 (typesize - partial > 1

Reply via email to