From: Christophe LYON <christophe.lyon@st.com>
To: gdb@sourceware.org
Subject: Unused variables in testsuite
Date: Fri, 28 Apr 2006 14:45:00 -0000 [thread overview]
Message-ID: <44522900.4090103@st.com> (raw)
Hi all,
While fixing our compiler, I came across strange tests in the GDB
testsuite: in some source files, some variables are defined but not used
by the code, but are references in the .exp.
Is there anywhere a requirement that the compiler should allocate unused
variable under -O0 ?
For instance, consider the test in gdb.cp/m-static.cc , m-static.h,
m-static1.cc.
You can see that in main() one defines "test4" which is not used, thus
need not be allocated. Then, using "print test4.elsewhere" under GDB
fails. [note that in this case the default (empty) constructor for test4
has no side effects, thus test4 can be eliminated safely]
In the same way, in gdb.mi/var-cmd.c , mi-var-display.exp, you can see
that function do_special_tests() defines several variables (eg 'u') and
does not use them, while the .exp file tries to "-var-create u * u".
I modified these tests so that the variables are used, and they now pass
with our compiler.
May I submit this small patch, or is there a requirement on GCC to
allocate even unused variables in -O0? (our compiler is not GCC)
Thanks,
Christophe.
next reply other threads:[~2006-04-28 14:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-28 14:45 Christophe LYON [this message]
2006-04-28 15:11 ` Daniel Jacobowitz
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=44522900.4090103@st.com \
--to=christophe.lyon@st.com \
--cc=gdb@sourceware.org \
/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