When running test-case gdb.reverse/until-reverse.exp or
gdb.reverse/until-precsave.exp with gcc-10, we run into a Wunused-result
warning:
...
gdb compile failed, gdb.reverse/until-reverse.c: In function 'main':
gdb.reverse/until-reverse.c:40:14: warning: ignoring return value of \
'malloc' declared with attribute 'warn_unused_result' [-Wunused-result]
40 | (void) malloc (1);
| ^~~~~~~~~~
...
Fix this by using the result of malloc as argument to a free call.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-05-01 Tom de Vries <tdevries@suse.de>
* gdb.reverse/until-reverse.c (main): Fix Wunused-result warning.
+2020-05-01 Tom de Vries <tdevries@suse.de>
+
+ * gdb.reverse/until-reverse.c (main): Fix Wunused-result warning.
+
2020-04-30 Hannes Domani <ssbssa@yahoo.de>
PR gdb/18706
{
/* We're used by a test that requires malloc, so make sure it is
in the executable. */
- (void) malloc (1);
+ void *p = malloc (1);
+ free (p);
return 1;
}