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: [C++ PATCH] Detect UB in shifts in constexpr functions


On 12/02/2014 09:14 AM, Marek Polacek wrote:
On Fri, Nov 28, 2014 at 09:28:03AM -0500, Jason Merrill wrote:
I was thinking even more detailed: one diagnostic for negative count, one
diagnostic for count larger than the precision of the lhs, and then a third
for overflow.

Alright, done.

Thanks. These errors also need to be conditional on (!ctx->quiet), and if we see one of these conditions we need to set *non_constant_p.

This was a little bit problematic, because I don't really know where
that formula comes from.  We use it in c-ubsan.c, so I've just taken
it from there.  It was Jakub who came with that formula, so maybe he
remembers its origin.  I wrote something more to the comment describing
it, even though that might not be enough.

Looks good.

Jason


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