This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR19100: truthvalue_conversion vs. TREE_CONSTANT_OVERFLOW
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Mark Mitchell <mark at codesourcery dot com>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 22 Dec 2004 00:27:30 +0000 (UTC)
- Subject: Re: [PATCH] PR19100: truthvalue_conversion vs. TREE_CONSTANT_OVERFLOW
- References: <Pine.LNX.4.44.0412211542060.1201-100000@www.eyesopen.com>
On Tue, 21 Dec 2004, Roger Sayle wrote:
> Unfortunately, there are two new failures both in gcc.dg/bitfld-2.c,
> missing warnings on lines 15 and 21. Joseph are these diagnostics for
> overflow on bitfield assignment required by the language standards,
> and if so is there an easy alternate way of generating them? The good
> news, however, is that is does resolve PR middle-end/19100.
They are not required - being warnings not pedwarns - but they are useful
warnings we should try to avoid losing.
I think we need a more detailed track of where the conversion is coming
from through folding. Explicit conversion through casts (build_c_cast)
deals with resetting overflow flags. Implicit conversion
(convert_and_check) gives warnings such as those in that testcase before
resetting the flags. This only covers those cases where the conversion of
a constant appears in the source rather than being generated through fold,
but it might be indicative of how such conversions are to be handled.
(Possibly, when fold generates such a conversion that wasn't in the
original input it should in any case reset the overflow flags as the
original code wasn't a constant expression so no diagnostics for the
overflow in conversion are expected and conversions unlike other overflow
don't yield undefined behavior.)
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)