[Bug sanitizer/64914] [UBSAN/bootstrap-ubsan] With -g3: libiberty/md5.c:336:7: runtime error: load of misaligned address for type 'const md5_uint32', which requires 4 byte alignment

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 3 10:58:00 GMT 2015


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dodji at gcc dot gnu.org,
                   |                            |dvyukov at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org,
                   |                            |kcc at gcc dot gnu.org
          Component|c++                         |sanitizer
            Summary|With -g3:                   |[UBSAN/bootstrap-ubsan]
                   |libiberty/md5.c:336:7:      |With -g3:
                   |runtime error: load of      |libiberty/md5.c:336:7:
                   |misaligned address  for     |runtime error: load of
                   |type 'const md5_uint32',    |misaligned address  for
                   |which requires 4 byte       |type 'const md5_uint32',
                   |alignment                   |which requires 4 byte
                   |                            |alignment

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The run-time error occurs for libiberty/md5.c:336 to 350, which look like:

      OP (B, C, D, A, 22, (md5_uint32) 0x49b40821);

with definitions:

  md5_uint32 A = ctx->A;
  md5_uint32 B = ctx->B;
  md5_uint32 C = ctx->C;
  md5_uint32 D = ctx->D;


#define OP(a, b, c, d, s, T)                                            \
      do                                                                \
        {                                                               \
          a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;             \
          ++words;                                                      \
          CYCLIC (a, s);                                                \
          a += b;                                                       \
        }                                                               \
      while (0)

At a glance, the code looks fine.



More information about the Gcc-bugs mailing list