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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-08-11
                 CC|                            |marxin at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot 
gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, following patch fixes aforementioned test-cases:

diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 33c06d40..f5dfcac 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -8583,7 +8583,8 @@ set_nonincremental_init_from_string (tree str,
                bitpos = (wchar_bytes - byte - 1) * charwidth;
              else
                bitpos = byte * charwidth;
-             val[bitpos % HOST_BITS_PER_WIDE_INT]
+             gcc_assert (bitpos / HOST_BITS_PER_WIDE_INT <= 1);
+             val[bitpos / HOST_BITS_PER_WIDE_INT]
                |= ((unsigned HOST_WIDE_INT) ((unsigned char) *p++))
                   << (bitpos % HOST_BITS_PER_WIDE_INT);
            }

Tomorrow, I'm going to test it more deeply and identify which active branches
are affected (I guess all as git blame shows quite old commits).

Martin

Reply via email to