Message ID | 1424456694-21705-1-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | Accepted |
Commit | 898f42e3a619461a69ca7f16eee3f985fa8287c1 |
Headers | show |
On Fri, Feb 20, 2015 at 12:24 PM, Maxim Uvarov <maxim.uvarov@linaro.org> wrote: > gcc 4.9 compiles current code fine, but gcc 4.7 fails > with: > odp_pool.c:293:20: error: 'seg_len' may be used > uninitialized in this function > Problem found with gcc 4.7 and make distcheck command which added > additional flags for odp compilation. If newer gcc does not warn that > variable can be used uninitialized (not for packet case in this function), > it looks like compiler bug. Init it to 0 because pool creation is not > performance function. > > Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> > Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> > --- platform/linux-generic/odp_pool.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/platform/linux-generic/odp_pool.c > b/platform/linux-generic/odp_pool.c > index 8da3801..422ff2b 100644 > --- a/platform/linux-generic/odp_pool.c > +++ b/platform/linux-generic/odp_pool.c > @@ -136,7 +136,7 @@ odp_pool_t odp_pool_create(const char *name, > ODP_CACHE_LINE_SIZE_ROUNDUP(init_params->udata_size) : > 0; > > - uint32_t blk_size, buf_stride, buf_num, seg_len; > + uint32_t blk_size, buf_stride, buf_num, seg_len = 0; > uint32_t buf_align = > params->type == ODP_POOL_BUFFER ? params->buf.align : 0; > > -- > 1.8.5.1.163.gd7aced9 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 8da3801..422ff2b 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -136,7 +136,7 @@ odp_pool_t odp_pool_create(const char *name, ODP_CACHE_LINE_SIZE_ROUNDUP(init_params->udata_size) : 0; - uint32_t blk_size, buf_stride, buf_num, seg_len; + uint32_t blk_size, buf_stride, buf_num, seg_len = 0; uint32_t buf_align = params->type == ODP_POOL_BUFFER ? params->buf.align : 0;
gcc 4.9 compiles current code fine, but gcc 4.7 fails with: odp_pool.c:293:20: error: 'seg_len' may be used uninitialized in this function Problem found with gcc 4.7 and make distcheck command which added additional flags for odp compilation. If newer gcc does not warn that variable can be used uninitialized (not for packet case in this function), it looks like compiler bug. Init it to 0 because pool creation is not performance function. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- platform/linux-generic/odp_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)