<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 3, 2015, at 1:32 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Feb 3, 2015 at 1:17 PM, Mehdi Amini <span dir="ltr" class=""><<a href="mailto:mehdi.amini@apple.com" target="_blank" class="">mehdi.amini@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Feb 3, 2015, at 12:32 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Feb 3, 2015 at 12:19 PM, Mehdi Amini <span dir="ltr" class=""><<a href="mailto:mehdi.amini@apple.com" target="_blank" class="">mehdi.amini@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi David,<div class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Feb 3, 2015, at 11:15 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><div class=""><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On Tue, Feb 3, 2015 at 11:03 AM, Owen Anderson<span class=""> </span><span dir="ltr" class=""><<a href="mailto:resistor@mac.com" target="_blank" class="">resistor@mac.com</a>></span><span class=""> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi chandlerc, joker.eph,<br class=""><br class="">This is useful when checking diagnostics and annotations that are only enabled in asserts mode. </blockquote><div class=""><br class=""></div><div class="">Not sure I quite follow - "REQUIRES: Asserts" would be used for any test case that's verifying a failure that's only enabled in asserts mode. "REQUIRES: no-asserts" would be for testing the absence of that same failure in a no-asserts build?<br class=""><br class="">That seems like a thing I wouldn't want to test for. The idea is that the program has undefined behavior if it would assert but you're in a non-asserts build. That's not a thing to test for - there's no specific/guaranteed behavior in that case.</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">To provide you with more context: I am expecting some optional metadata from the front-end, but in case they are malformed for any reason I want to be bullet proof and handle this case gracefully (i.e. undefined behavior / crashing is not acceptable). So I’d like my assert build to verify the validity of the metadata but my release build to ignore it and set a suitable default value that I know allows recovery most of the time.</div><div class=""><br class=""></div><div class="">I can’t add a test to check if we recover correctly from an invalid metadata without this.</div><div class=""><br class=""></div><div class="">This is valid in general for the category of assertions we put to enforce some invariant/properties that are important for optimization purposes but does not prevent us from generating a correct code if they are broken.</div><div class=""><br class=""></div><div class="">Does it make sense?</div></div></div></div></blockquote><div class=""><br class="">Not sure how everyone else feels, but I'd rather classify something like that that has well-defined recovery semantics, as something other than 'validity’. <br class=""></div></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">To be sure I understand correctly: do you mean an assertions is not welcome on the normal path if we have a well-defined recovery path?</div></div></div></blockquote><div class=""><br class="">That's my opinion: Failure to satisfy assertions implies UB and cannot be tested for or verified in any way. Any assertion failure represents an invariant in the program. If that's not the case then it's defined behavior we should be always testing for. Otherwise it seems too easy to introduce failures in the expected graceful recovery path.<br class=""></div></div></div></div></div></blockquote><div><br class=""></div><div>Thanks for your input. That’s fine with me. </div><div>But then what is it the alternative? I’d still like a mechanism that would be “report an error in debug mode and handle gracefully in release” for the thing that don’t go in the category you describe. If assert() is not appropriated, do you have a suggestion?</div><div><br class=""></div><div>Thanks,</div><div><br class=""></div><div>Mehdi</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class="">Not sure about other people, maybe the prevailing attitude is not consistent with mine.<br class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">— </div><span class="HOEnZb"><font color="#888888" class=""><div class="">Mehdi</div></font></span><div class=""><div class="h5"><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class="">When/where/how do you expect invalid metadata to come into your system?<br class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><br class=""></div><div class="">Thanks.</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">Mehdi</div></font></span><span class=""><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Today we can only test the positive case (when asserts are enabled) but not the negative case.<br class=""><br class="">REPOSITORY<br class=""> <span class=""> </span>rL LLVM<br class=""><br class=""><a href="http://reviews.llvm.org/D7383" target="_blank" class="">http://reviews.llvm.org/D7383</a><br class=""><br class="">Files:<br class=""> <span class=""> </span>test/lit.cfg<br class=""><br class="">Index: test/lit.cfg<br class="">===================================================================<br class="">--- test/lit.cfg<br class="">+++ test/lit.cfg<br class="">@@ -370,6 +370,8 @@<br class=""><br class=""> if re.search(r'ON', llvm_config_cmd.stdout.read().decode('ascii')):<br class="">     config.available_features.add('asserts')<br class="">+else:<br class="">+    config.available_features.add('no-asserts')<br class=""> llvm_config_cmd.wait()<br class=""><br class=""> if 'darwin' == sys.platform:<br class=""><br class="">EMAIL PREFERENCES<br class=""> <span class=""> </span><a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank" class="">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank" class="">llvm-commits@cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></blockquote></div></div></blockquote></span></div><br class=""></div></div></blockquote></div><br class=""></div></div>
</div></blockquote></div></div></div><br class=""></div></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>