diff mbox

[01/35] Introduce new type-based pool allocator.

Message ID 556DB52D.9080903@suse.cz
State New
Headers show

Commit Message

Martin Liška June 2, 2015, 1:52 p.m. UTC
On 06/02/2015 11:48 AM, Andreas Schwab wrote:
> In file included from ../../gcc/stmt.c:78:0:
> ../../gcc/alloc-pool.h: In function 'void expand_sjlj_dispatch_table(rtx, vec<t\
> ree_node*>)':
> ../../gcc/alloc-pool.h:303:4: error: 'case_node_pool.pool_allocator<case_node>:\
> :m_block_size' may be used uninitialized in this function [-Werror=maybe-uninit\
> ialized]
>     block = XNEWVEC (char, m_block_size);
>     ^
> ../../gcc/stmt.c:1339:33: note: 'case_node_pool.pool_allocator<case_node>::m_bl\
> ock_size' was declared here
>        pool_allocator<case_node> case_node_pool ("struct sjlj_case pool",
>                                  ^
> 
> Andreas.
> 

Hi.

This patch for the issue which has been tested on x86_64-unknown-linux-pc and
can bootstrap.

Ready for trunk?
Thanks,
Martin

Comments

Richard Biener June 2, 2015, 2 p.m. UTC | #1
On Tue, Jun 2, 2015 at 3:52 PM, Martin Liška <mliska@suse.cz> wrote:
> On 06/02/2015 11:48 AM, Andreas Schwab wrote:
>> In file included from ../../gcc/stmt.c:78:0:
>> ../../gcc/alloc-pool.h: In function 'void expand_sjlj_dispatch_table(rtx, vec<t\
>> ree_node*>)':
>> ../../gcc/alloc-pool.h:303:4: error: 'case_node_pool.pool_allocator<case_node>:\
>> :m_block_size' may be used uninitialized in this function [-Werror=maybe-uninit\
>> ialized]
>>     block = XNEWVEC (char, m_block_size);
>>     ^
>> ../../gcc/stmt.c:1339:33: note: 'case_node_pool.pool_allocator<case_node>::m_bl\
>> ock_size' was declared here
>>        pool_allocator<case_node> case_node_pool ("struct sjlj_case pool",
>>                                  ^
>>
>> Andreas.
>>
>
> Hi.
>
> This patch for the issue which has been tested on x86_64-unknown-linux-pc and
> can bootstrap.
>
> Ready for trunk?

Ok.

Richard.

> Thanks,
> Martin
diff mbox

Patch

From 57355c1e271accc3e35dd5df9d5393ee783d765b Mon Sep 17 00:00:00 2001
From: mliska <mliska@suse.cz>
Date: Tue, 2 Jun 2015 13:26:05 +0200
Subject: [PATCH] Pool allocator fallout: fix uninialized class members.

gcc/ChangeLog:

2015-06-02  Martin Liska  <mliska@suse.cz>

	* alloc-pool.h (pool_allocator::pool_allocator): Set implicit
	values to avoid -Wmaybe-uninitialized errors.
---
 gcc/alloc-pool.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gcc/alloc-pool.h b/gcc/alloc-pool.h
index 96a1342..ddb2a91 100644
--- a/gcc/alloc-pool.h
+++ b/gcc/alloc-pool.h
@@ -159,11 +159,11 @@  template <typename T>
 inline
 pool_allocator<T>::pool_allocator (const char *name, size_t num,
 				   size_t extra_size, bool ignore_type_size):
-  m_name (name), m_elts_per_block (num), m_returned_free_list (NULL),
+  m_name (name), m_id (0), m_elts_per_block (num), m_returned_free_list (NULL),
   m_virgin_free_list (NULL), m_virgin_elts_remaining (0), m_elts_allocated (0),
   m_elts_free (0), m_blocks_allocated (0), m_block_list (NULL),
-  m_ignore_type_size (ignore_type_size), m_extra_size (extra_size),
-  m_initialized (false) {}
+  m_block_size (0), m_ignore_type_size (ignore_type_size),
+  m_extra_size (extra_size), m_initialized (false) {}
 
 /* Initialize a pool allocator.  */
 
@@ -215,7 +215,6 @@  pool_allocator<T>::initialize ()
 
   m_id = last_id;
 #endif
-
 }
 
 /* Free all memory allocated for the given memory pool.  */
-- 
2.1.4