From: Daniel Jacobowitz <drow@false.org>
To: Christophe LYON <christophe.lyon@st.com>
Cc: gdb@sourceware.org
Subject: Re: Unused variables in testsuite
Date: Fri, 28 Apr 2006 15:11:00 -0000 [thread overview]
Message-ID: <20060428144158.GA29211@nevyn.them.org> (raw)
In-Reply-To: <44522900.4090103@st.com>
On Fri, Apr 28, 2006 at 04:38:56PM +0200, Christophe LYON wrote:
> Is there anywhere a requirement that the compiler should allocate unused
> variable under -O0 ?
This sort of requirement is never documented anywhere; it's just a
question of common practice. Which in practice means GCC, until
someone is interested in making it more portable.
> 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)
I'd recommend submitting it. We (CodeSourcery) have been slowly
submitting patches to allow the testsuite to run with yet another
compiler (ARM's); we hadn't gotten to this one yet, but I think it's in
there somewhere, because I remember having to modify m-static*.
--
Daniel Jacobowitz
CodeSourcery
prev parent reply other threads:[~2006-04-28 14:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-28 14:45 Christophe LYON
2006-04-28 15:11 ` Daniel Jacobowitz [this message]
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=20060428144158.GA29211@nevyn.them.org \
--to=drow@false.org \
--cc=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