Re: [PATCH] Do without on-stack variable length arrays.

2015-09-08 Thread Chih-hung Hsieh
I have replaced this patch with a new one that does not use one element arrays. Please take a look of [PATCH] Do without union of variable length arrays. Thanks. On Fri, Sep 4, 2015 at 3:14 PM, Roland McGrath wrote: > > Is there some simple way that I can test elfutils with fortify or bound

Re: [PATCH] Do without on-stack variable length arrays.

2015-09-04 Thread Roland McGrath
> Is there some simple way that I can test elfutils with fortify or bound > checking tools? Depending on your system and build setup, _FORTIFY_SOURCE might be the default. It's easy enough to enable it with CPPFLAGS=-D_FORTIFY_SOURCE=2 to configure AFAIK. > How about using pointers and malloc or

Re: [PATCH] Do without on-stack variable length arrays.

2015-09-04 Thread Chih-hung Hsieh
Yes, I shall correct the description. Is there some simple way that I can test elfutils with fortify or bound checking tools? How about using pointers and malloc or alloca, and indexing through the pointers? That should avoid complaints from stronger bound checkers, although static bound checking

Re: [PATCH] Do without on-stack variable length arrays.

2015-09-04 Thread Roland McGrath
This is misstated. VLAs are a standard feature. What you're avoiding here is VLA members of structs and unions, which are a GNU extension. I also don't think you're doing it the ideal way. A union of two arrays of length one is useless. It might trigger complaints from _FORTIFY_SOURCE or othe

[PATCH] Do without on-stack variable length arrays.

2015-09-04 Thread Chih-Hung Hsieh
Prepare to compile without gnu99 extension. Signed-off-by: Chih-Hung Hsieh --- libdwfl/dwfl_module_getdwarf.c | 16 libdwfl/dwfl_segment_report_module.c | 16 libdwfl/elf-from-memory.c| 8 libdwfl/link_map.c | 26 +++