From: Jan Hubicka Date: Thu, 29 Oct 2020 15:44:48 +0000 (+0100) Subject: Avoid typeless storage in wide-int X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0da3e7668c429cc356d96aac4b72c0c01c027b34;p=gcc.git Avoid typeless storage in wide-int * wide-int.h (trailing_wide_ints ): Turn len to array of structures so it does not imply typeless storage. (trailing_wide_ints ::operator): update (trailing_wide_ints ::operator []): Update. --- diff --git a/gcc/wide-int.h b/gcc/wide-int.h index 39cd5b9bd17..6eae46da12e 100644 --- a/gcc/wide-int.h +++ b/gcc/wide-int.h @@ -1387,8 +1387,10 @@ private: /* The shared maximum length of each number. */ unsigned char m_max_len; - /* The current length of each number. */ - unsigned char m_len[N]; + /* The current length of each number. + Avoid char array so the whole structure is not a typeless storage + that will, in turn, turn off TBAA on gimple, trees and RTL. */ + struct {unsigned char len;} m_len[N]; /* The variable-length part of the structure, which always contains at least one HWI. Element I starts at index I * M_MAX_LEN. */ @@ -1470,7 +1472,7 @@ template inline trailing_wide_int trailing_wide_ints ::operator [] (unsigned int index) { - return trailing_wide_int_storage (m_precision, &m_len[index], + return trailing_wide_int_storage (m_precision, &m_len[index].len, &m_val[index * m_max_len]); } @@ -1479,7 +1481,7 @@ inline typename trailing_wide_ints ::const_reference trailing_wide_ints ::operator [] (unsigned int index) const { return wi::storage_ref (&m_val[index * m_max_len], - m_len[index], m_precision); + m_len[index].len, m_precision); } /* Return how many extra bytes need to be added to the end of the structure