<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 10, 2013, at 6:39 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">On Thu, Jan 10, 2013 at 12:31 PM, jahanian <<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>> wrote:<br><blockquote type="cite"><br>On Jan 9, 2013, at 5:58 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br><br><blockquote type="cite"><br></blockquote><br>I want to issue warning when case value overflows. EvaluateKnownConstInt detects<br>this by returning a note and callers are expected to issue the warning based on the note returned.<br>Similar case is handled at end of CheckConvertedConstantExpression.<br></blockquote><br>Well, in CheckConvertedConstantExpression, a diagnostic is produced<br>any time the evaluation produces notes. In this case, we only issue a<br>diagnostic for one of the notes. I'm concerned that this code would be<br>broken if we split that note into multiple notes with more details for<br>some cases -- and, in fact, there already is such a separate note for<br>signed left shift overflow.<br></blockquote><div><br></div>There are many notes. But there is one note_constexpr_overflow for the overflows.</div><div>Are you suggesting something different than checking for this note?</div><div> (Maybe you are suggesting that we separately check for overflow condition only?).</div><div><blockquote type="cite"><br>Have you thought about always warning when an expression contains an<br>overflowing calculation, not only when such an overflow appears in a<br>case expression (like we already do for left shifts, for instance)?<br></blockquote><div><br></div>Are you suggesting moving the warning to individual operations;  <span style="font-family: Menlo; font-size: 11px; ">CheckAdditionOperands,</span></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(49, 89, 93); ">CheckMultiplyDivideOperands and the like? left shift diagnostic</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(49, 89, 93); ">is done in CheckShiftOperands.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(49, 89, 93); "><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(49, 89, 93); ">- Fariborz</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(49, 89, 93); "><br></div></div><div><font face="Menlo"><span style="font-size: 11px;"><br></span></font><blockquote type="cite"><br><blockquote type="cite">Also, I changed the warning per your other comments.<br>In r172102.<br></blockquote><br>Thanks! The "results in a new value" wording seems a bit awkward, how<br>about just saying "overflow in case constant expression results in<br>value %0"?<br></blockquote></div><br></body></html>