This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR19100: truthvalue_conversion vs. TREE_CONSTANT_OVERFLOW


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]