[cfe-dev] [ubsan] Add -fsanitize-warn-once, only emit runtime error once per check

Dmitri Gribenko gribozavr at gmail.com
Thu Dec 13 10:05:54 PST 2012


On Thu, Dec 13, 2012 at 7:33 PM, Will Dietz <willdtz at gmail.com> wrote:
> This flag causes clang to emit a byte for each check that is used by the
> runtime to track whether we've already printed an error for that check.
>
>  Often failed checks are triggered many times dynamically, but a user
>  is only interested in which checks failed (with example dynamic values
>  to aid in debugging).  This flag lets the user make such runs much
>  more efficient and generate more manageable output.

Hi Will,

+  if (Checked) {
+    if (*Checked) return;
+    *Checked = true;
+  }

Does it make sense to do the store atomically?  The user's program is
already buggy, but introducing a possible data race is unfortunate.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-dev mailing list