On 5/12/23 19:52, Florian Weimer wrote:
* Florian Weimer:

In summary, all these seems to be good candidates for errors by default:

* int-conversion as errors (already raised separately
* -Wint-conversion for ?:
* parameter names in non-prototype function declarations
* the union wait function pointer compatibility kludge
* return-with-out-value for non-void functions
* -Wincomatible-pointer-types warning for ?: (but no error yet, see below)
I think we have another problem.

We do not warn by default for:

   int x;
   unsigned *p;

   p = &x;

Isn't that a conformance issue because the pointers are incompatible,
requiring a diagnostic?

Furthermore, Unlike the char case, this tends to introduce
strict-aliasing violations, so there is a good reason to treat this
variant as an error (even if we would only warn for char * and
unsigned char *).

Isn't this allowed by the standard ? 6.5.7. Expressions states:
> An object shall have its stored value accessed only by an lvalue expression that has one of thefollowing types:[...] - a type that is the signed or unsigned type corresponding to the effective type of the object

Reply via email to