This is the mail archive of the gcc-cvs@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]

r262961 - in /trunk/gcc: ChangeLog hwint.c


Author: rsandifo
Date: Wed Jul 25 08:41:35 2018
New Revision: 262961

URL: https://gcc.gnu.org/viewcvs?rev=262961&root=gcc&view=rev
Log:
Fix ceil_log2(0) (PR 86644)

This PR shows a pathological case in which we try SLP vectorisation on
dead code.  We record that 0 bits of the result are enough to satisfy
all users (which is true), and that led to precision being 0 in:

static unsigned int
vect_element_precision (unsigned int precision)
{
  precision = 1 << ceil_log2 (precision);
  return MAX (precision, BITS_PER_UNIT);
}

ceil_log2 (0) returned 64 rather than 0, leading to 1 << 64, which is UB.

2018-07-25  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* hwint.c (ceil_log2): Fix comment.  Return 0 for 0.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/hwint.c


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