RE: [RFC PATCH 03/13] usb: remove the usage of the list iterator after the loop
From: David Laight
Date: Mon Feb 28 2022 - 01:16:16 EST
From: Linus Torvalds
> Sent: 27 February 2022 21:05
...
> And then the C standards people decided that "because our job isn't to
> describe all the architectural issues you can hit, we'll call it
> undefined, and in the process let compiler people intentionally break
> it".
>
> THAT is a problem.
I'm waiting for them to decide that memset(ptr, 0, len) of
any structure that contains a pointer is UB (because a NULL
pointer need not be the all zero bit pattern) so decide
to discard the call completely (or some such).
Non-zero NULL pointers is the only reason arithmetic on NULL
pointers isn't valid.
Or maybe that character range tests are UB because '0' to '9'
don't have to be adjacent - they are even adjacent in EBCDIC.
Some of the 'strict aliasing' bits are actually useful since
they let the compiler reorder reads and writes.
But the definition is brain-dead.
Sometimes it would be nice to have byte writes reordered,
but even using int:8 doesn't work.
I have never worked out what 'restrict' actually does,
in any places I've tried it did nothing.
Although I may have been hoping it would still help when
the function got inlined.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)