gcore.c (array_func): Add reference to static_array.
Commit Message
Hi.
This test fails with clang because it discards static_array,
it's unreferenced anywhere.
Is there a preferred way to handle this?
The current way is chosen for portability (instead of, say,
an attribute).
2015-09-15 Doug Evans <dje@google.com>
* gdb.base/gcore.c (array_func): Add reference to static_array.
Comments
On Tue, Sep 15, 2015 at 2:33 PM, Doug Evans <dje@google.com> wrote:
> Hi.
>
> This test fails with clang because it discards static_array,
> it's unreferenced anywhere.
>
> Is there a preferred way to handle this?
> The current way is chosen for portability (instead of, say,
> an attribute).
>
> 2015-09-15 Doug Evans <dje@google.com>
>
> * gdb.base/gcore.c (array_func): Add reference to static_array.
Committed.
@@ -46,6 +46,8 @@ array_func ()
un_initialized_array[i] = extern_array[i] + 8;
local_array[i] = extern_array[i] + 12;
}
+ /* Reference static_array so that clang doesn't discard it. */
+ (void) static_array[0];
terminal_func ();
}