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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---

From
https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-counted_005fby-variable-attribute
:

>p->array and p->count can only be changed by changing the whole structure at 
>the same time.



So you need to do:
```
        int nl = buf->len-1;
        char *np = buf->ptr + 1;
        *buf = (struct buffer) {np,nl};
```

To get this to be well defined code.

Reply via email to