On Fri, Feb 24, 2023 at 12:15:04PM +0000, Richard Biener wrote:
> > > Anyway, I wonder if you get the -Werror=stringop-overflow= errors during
> > > bootstrap that I got with my version or not.
>
> Yes, I get this as well, not sure how to suppress it. I guess there's
> no standard way to get at the address after some object without going
> through uintptr obfuscation - and obviously we do not want to have
> that (and if we optimize it away that doesn't help the diagnostic ...)
As I wrote on IRC, incremental:
--- gcc/vec.h 2023-02-24 11:54:49.859564268 +0100
+++ gcc/vec.h 2023-02-24 14:13:38.199163428 +0100
@@ -1553,7 +1553,8 @@
auto_vec ()
{
m_auto.embedded_init (MAX (N, 2), 0, 1);
- this->m_vec = &m_auto;
+ size_t off = (char *) &m_auto - (char *) this;
+ this->m_vec = (vec<T, va_heap, vl_embed> *) ((char *) this + off);
}
auto_vec (size_t s CXX_MEM_STAT_INFO)
@@ -1565,7 +1566,8 @@
}
m_auto.embedded_init (MAX (N, 2), 0, 1);
- this->m_vec = &m_auto;
+ size_t off = (char *) &m_auto - (char *) this;
+ this->m_vec = (vec<T, va_heap, vl_embed> *) ((char *) this + off);
}
~auto_vec ()
fixes the -Werror=stringop-overflow= errors for me during stage3, but
haven't done full bootstrap.
It is very ugly, but works.
Jakub