On Tue, Aug 06, 2013 at 07:07:27PM -0400, Jason Merrill wrote:
> >I think, what we could do, is to tweak verify_constant like this:
> >
> >+ /* This is to handle e.g. the goofy 'case 0 * (1 / 0)' case. */
> >+ if (flag_sanitize & SANITIZE_UNDEFINED
> >+ && TREE_CODE (t) == CALL_EXPR
> >+ && is_ubsan_builtin (t))
> >+ {
> >+ error ("undefined behavior occured");
> >+ return *non_constant_p;
> >+ }
>
> I think I'd rather handle ubsan builtins specially in dump_expr.
I might've misunderstood what you mean. If we drop the hunk above,
then we'll call
error ("%q+E is not a constant expression", t);
so, we'll print "is not a constant expression" no matter what, we
surely can recognize the ubsan built-ins in dump_expr, but what would
we do then?
Marek