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

--- Comment #15 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #11)
> (In reply to Manuel López-Ibáñez from comment #8)
> > I'll defer to Joseph or any other C FE maintainers to make the final call.
> 
> https://gcc.gnu.org/ml/gcc-patches/2004-01/msg00599.html
> 
> See that email about how this is invalid conversions from JSM already.

The meaning of -Wpedantic has been refined over time and not all warnings under
-Wpedantic are pedwarns (but they should be) and not all pedwarns are
controlled by -Wpedantic (but they should be controlled by some flag). Also
-pedantic-errors is not the same as -Werror=pedantic (but it should be a
superset, which currently is not).

The questions that decide whether some diagnostic is an error with
-pedantic-errors are:

* Does the standard says that such conversions should be rejected or require a
diagnostic? My understanding is that the answer is No.

* Does any potential undefined behaviour happen at compile-time or runtime? My
understanding is that the answer is Compile-time.

This seems the same case as -Wshift-negative-value:

https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01551.html

Hence, the warning should not be an error with -pedantic-errors, hence, it
should not be a pedwarn(), hence, it should not be a warning controlled by
-Wpedantic.

It can be still a warning, controlled by another flag, not enabled by
-Wpedantic.


(In reply to Keith Thompson from comment #12)
> Is my understanding correct?

The behaviour of the flags is detailed in the manual since a few years:

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-pedantic-errors-1

Thus, -pedantic-errors will also give errors for compile-time UB and "in some
other cases that do not prevent compilation of programs that are valid
according to the standard"

Reply via email to