On Fri, Feb 24, 2023 at 11:59:53AM +0100, Jakub Jelinek via Gcc-patches wrote:
> > This needs to be alignas(T) unsigned char m_data[sizeof(T) * N];
> 
>   unsigned char m_data[MAX (N, 2) * sizeof (T)];
> 
> if we want to preserve current behavior I think.
> 
> I've screwed up, when I was about to change this line, I've realized
> I want to look at the embedded_size stuff first and then forgot
> to update this.  With the above line it builds, though I bet one will need
> to compare the generated code etc. and test with GCC 4.8.
> 
> Though I guess we now have also an option to change auto_vec with N 0/1
> to have 1 embedded element instead of 2, so that would also mean changing
> all of MAX (N, 2) to MAX (N, 1) if we want.

It builds then in non-optimized build, but when I try to build it in stage3,
the useless middle-end warnings kick in:

In member function ‘T* vec<T, A, vl_embed>::quick_push(const T&) [with T = 
parameter; A = va_heap]’,
    inlined from ‘T* vec<T>::quick_push(const T&) [with T = parameter]’ at 
../../gcc/vec.h:1957:28,
    inlined from ‘void populate_pattern_routine(create_pattern_info*, 
merge_state_info*, state*, const vec<parameter, va_heap, vl_ptr>&)’ at 
../../gcc/genrecog.cc:3008:29:
../../gcc/vec.h:1021:3: error: writing 1 byte into a region of size 0 
[-Werror=stringop-overflow=]
 1021 |   *slot = obj;
      |   ^
../../gcc/vec.h: In function ‘void 
populate_pattern_routine(create_pattern_info*, merge_state_info*, state*, const 
vec<parameter, va_heap, vl_ptr>&)’:
../../gcc/vec.h:1585:29: note: at offset 12 into destination object 
‘auto_vec<parameter, 5>::m_auto’ of size 8
 1585 |   vec<T, va_heap, vl_embed> m_auto;
      |                             ^~~~~~
In member function ‘T* vec<T, A, vl_embed>::quick_push(const T&) [with T = 
parameter; A = va_heap]’,
    inlined from ‘T* vec<T>::quick_push(const T&) [with T = parameter]’ at 
../../gcc/vec.h:1957:28,
    inlined from ‘decision* init_pattern_use(create_pattern_info*, 
merge_state_info*, const vec<parameter, va_heap, vl_ptr>&)’ at 
../../gcc/genrecog.cc:2886:26:
../../gcc/vec.h:1021:3: error: writing 1 byte into a region of size 0 
[-Werror=stringop-overflow=]
 1021 |   *slot = obj;
      |   ^
../../gcc/vec.h: In function ‘decision* init_pattern_use(create_pattern_info*, 
merge_state_info*, const vec<parameter, va_heap, vl_ptr>&)’:
../../gcc/vec.h:1585:29: note: at offset 12 into destination object 
‘auto_vec<parameter, 5>::m_auto’ of size 8
 1585 |   vec<T, va_heap, vl_embed> m_auto;
      |                             ^~~~~~


        Jakub

Reply via email to