From: Joel Brobecker <brobecker@adacore.com>
To: Tobias Burnus <tobias.burnus@physik.fu-berlin.de>
Cc: gdb-patches@sourceware.org
Subject: Re: gdb fails to compile with GCC 4.4.7 (was: [PATCH V4 5/9] New probe type: DTrace USDT probes.)
Date: Fri, 27 Mar 2015 13:42:00 -0000 [thread overview]
Message-ID: <20150327134252.GD13867@adacore.com> (raw)
In-Reply-To: <20150327094653.GA29713@physik.fu-berlin.de>
[-- Attachment #1: Type: text/plain, Size: 791 bytes --]
> I think this patch (commit 429e1e811b400f07b5a514ea6b8a70b28e2d7ee9) causes
> gdb's compilation to fail with GCC 4.4.7 (RHEL 6 system compiler) as follows;
> it does work with GCC 5.
>
> cc1: warnings being treated as errors
> ../../gdb/dtrace-probe.c: In function âdtrace_process_dof_probeâ:
> ../../gdb/dtrace-probe.c:416: error: âexprâ may be used uninitialized in this function
> make[2]: *** [dtrace-probe.o] Error 1
>
>
> I think that looks spurious as the code looks fine (i.e. GCC is overzaelous), still,
> a "= NULL" should harm.
Would you mind checking that the attached patch fixes the problem?
gdb/ChangeLog:
* dtrace-probe.c (dtrace_process_dof_probe): Initialize expr to NULL.
Tested on x86_64-linux by rebuilding GDB.
Thank you,
--
Joel
[-- Attachment #2: 0001-Initialize-EXPR-in-dtrace-probe-dtrace_process_dof_p.patch --]
[-- Type: text/x-diff, Size: 1395 bytes --]
From 9b1d494cfb04c4d05252af84545f060bd67bcb87 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Fri, 27 Mar 2015 06:37:34 -0700
Subject: [PATCH] Initialize EXPR in dtrace-probe::dtrace_process_dof_probe
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
GCC 4.4.7 generates the following warning:
| cc1: warnings being treated as errors
| dtrace-probe.c: In function âdtrace_process_dof_probeâ:
| dtrace-probe.c:416: error: âexprâ may be used uninitialized in this function
| make[2]: *** [dtrace-probe.o] Error 1
Later versions (GCC 5) do a better job and don't generate the warning,
but it does not hurt to pre-initialize "expr" to NULL.
gdb/ChangeLog:
* dtrace-probe.c (dtrace_process_dof_probe): Initialize expr to NULL.
---
gdb/dtrace-probe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index ff7ce7d..3f2548d 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -413,7 +413,7 @@ dtrace_process_dof_probe (struct objfile *objfile,
for (j = 0; j < ret->probe_argc; j++)
{
struct dtrace_probe_arg arg;
- struct expression *expr;
+ struct expression *expr = NULL;
/* Set arg.expr to ensure all fields in expr are initialized and
the compiler will not warn when arg is used. */
--
1.9.1
next prev parent reply other threads:[~2015-03-27 13:42 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-02 10:57 [PATCH V4 0/9] Add support for DTrace USDT probes to gdb Jose E. Marchesi
2015-02-02 10:57 ` [PATCH V4 6/9] Support for DTrace USDT probes in x86_64 targets Jose E. Marchesi
2015-02-17 1:37 ` Sergio Durigan Junior
2015-02-02 10:57 ` [PATCH V4 4/9] New gdbarch functions: dtrace_parse_probe_argument, dtrace_probe_is_enabled, dtrace_enable_probe, dtrace_disable_probe Jose E. Marchesi
2015-02-17 1:14 ` Sergio Durigan Junior
2015-02-02 10:57 ` [PATCH V4 5/9] New probe type: DTrace USDT probes Jose E. Marchesi
2015-02-17 1:35 ` Sergio Durigan Junior
2015-03-25 19:14 ` Joel Brobecker
2015-03-26 16:15 ` Jose E. Marchesi
2015-03-26 17:50 ` Joel Brobecker
2015-03-26 18:43 ` Joel Brobecker
2015-03-26 18:53 ` Sergio Durigan Junior
2015-03-26 21:00 ` Joel Brobecker
2015-03-27 9:47 ` gdb fails to compile with GCC 4.4.7 (was: [PATCH V4 5/9] New probe type: DTrace USDT probes.) Tobias Burnus
2015-03-27 13:42 ` Joel Brobecker [this message]
2015-03-27 15:18 ` Tobias Burnus
2015-03-27 15:27 ` [pushed] " Joel Brobecker
2015-03-27 16:58 ` H.J. Lu
2015-03-26 23:39 ` [PATCH V4 5/9] New probe type: DTrace USDT probes Jose E. Marchesi
2015-03-31 17:29 ` Jose E. Marchesi
2015-03-31 18:47 ` Joel Brobecker
2015-03-31 19:54 ` Jose E. Marchesi
2015-08-06 21:31 ` Joel Brobecker
2015-08-07 2:03 ` Sergio Durigan Junior
2015-08-07 15:20 ` Joel Brobecker
2015-08-07 13:05 ` Jose E. Marchesi
2015-08-07 13:14 ` Jose E. Marchesi
2015-08-07 14:11 ` Jose E. Marchesi
2015-08-07 15:12 ` Joel Brobecker
2015-08-10 3:21 ` Sergio Durigan Junior
2015-08-10 14:31 ` Jose E. Marchesi
2015-02-02 10:57 ` [PATCH V4 8/9] Documentation for " Jose E. Marchesi
2015-02-02 16:03 ` Eli Zaretskii
2015-02-02 19:47 ` Jose E. Marchesi
2015-02-02 10:57 ` [PATCH V4 2/9] Move `compute_probe_arg' and `compile_probe_arg' to probe.c Jose E. Marchesi
2015-02-17 1:13 ` Sergio Durigan Junior
2015-02-02 10:57 ` [PATCH V4 3/9] New commands `enable probe' and `disable probe' Jose E. Marchesi
2015-02-02 16:01 ` Eli Zaretskii
2015-02-17 1:54 ` Sergio Durigan Junior
2015-02-02 10:57 ` [PATCH V4 7/9] Simple testsuite for DTrace USDT probes Jose E. Marchesi
2015-02-02 11:18 ` Jose E. Marchesi
2015-02-17 1:53 ` Sergio Durigan Junior
2015-02-17 1:58 ` Sergio Durigan Junior
2015-02-17 11:32 ` Pedro Alves
2015-02-02 10:57 ` [PATCH V4 1/9] Adapt `info probes' to support printing probes of different types Jose E. Marchesi
2015-02-17 1:12 ` Sergio Durigan Junior
2015-02-02 10:57 ` [PATCH V4 9/9] Announce the DTrace USDT probes support in NEWS Jose E. Marchesi
2015-02-02 16:03 ` Eli Zaretskii
2015-02-16 13:20 ` [PATCH V4 0/9] Add support for DTrace USDT probes to gdb Jose E. Marchesi
2015-02-17 1:57 ` Sergio Durigan Junior
2015-02-17 11:56 ` Jose E. Marchesi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150327134252.GD13867@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=tobias.burnus@physik.fu-berlin.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox