This patch 2019-06-10 Martin Liska <mliska@suse.cz> * ansidecl.h: (ATTRIBUTE_RESULT_SIZE_1): Define new macro. (ATTRIBUTE_RESULT_SIZE_2): Likewise. (ATTRIBUTE_RESULT_SIZE_1_2): Likewise. * libiberty.h (xmalloc): Add RESULT_SIZE attribute. (xrealloc): Likewise. (xcalloc): Likewise. broke bootstrap on Solaris/x86 and Solaris/SPARC (and probably other 32-bit targets): In file included from /vol/gcc/src/hg/trunk/local/gcc/system.h:691, from /vol/gcc/src/hg/trunk/local/gcc/trans-mem.c:23: In function 'void tm_memopt_compute_available(tm_region*, vec<basic_block_def*>)', inlined from 'unsigned int execute_tm_memopt()' at /vol/gcc/src/hg/trunk/local/gcc/trans-mem.c:4047:35, inlined from 'virtual unsigned int {anonymous}::pass_tm_memopt::execute(function*)' at /vol/gcc/src/hg/trunk/local/gcc/trans-mem.c:4087:72: /vol/gcc/src/hg/trunk/local/gcc/../include/libiberty.h:362:39: error: argument 1 value '4294967292' exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=] 362 | #define XNEWVEC(T, N) ((T *) xmalloc (sizeof (T) * (N))) | ~~~~~~~~^~~~~~~~~~~~~~~~~~ /vol/gcc/src/hg/trunk/local/gcc/trans-mem.c:3713:5: note: in expansion of macro 'XNEWVEC' 3713 | XNEWVEC (basic_block, qlen); | ^~~~~~~ In file included from /vol/gcc/src/hg/trunk/local/gcc/system.h:691, from /vol/gcc/src/hg/trunk/local/gcc/trans-mem.c:23: /vol/gcc/src/hg/trunk/local/gcc/../include/libiberty.h: In member function 'virtual unsigned int {anonymous}::pass_tm_memopt::execute(function*)': /vol/gcc/src/hg/trunk/local/gcc/../include/libiberty.h:313:14: note: in a call to allocation function 'void* xmalloc(std::size_t)' declared here 313 | extern void *xmalloc (size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_RESULT_SIZE_1 ATTRIBUTE_WARN_UNUSED_RESULT; | ^~~~~~~
Yeah, I see it too. The caller guarantees blocks.length () is at least 1 (as it always pushes entry_block in there), so in qlen = blocks.length () - 1; qin = qout = worklist = XNEWVEC (basic_block, qlen); qlen is never -1U, but the compiler doesn't know this.
Testing patch for this.
Thank you Jakub.
Author: jakub Date: Tue Jun 11 08:20:02 2019 New Revision: 272145 URL: https://gcc.gnu.org/viewcvs?rev=272145&root=gcc&view=rev Log: PR bootstrap/90819 * trans-mem.c (tm_memopt_compute_available): Add assertion that blocks is not empty. Formatting fix. Modified: trunk/gcc/ChangeLog trunk/gcc/trans-mem.c
Fixed.