old-cross-binutils/gdb/testsuite/gdb.cp
Pedro Alves 4819b3f897 Fix ptype bug actually exercised in userdef.exp
I happened to notice a bug with ptype &Ref, and found out userdef.exp
actually exercises the bug.  With:

class Container
{
public:
  Member m;

  Member& operator* ();
};

Member& Container::operator* ()
{
  return this->m;
}

And 'c' is of type Container:

(gdb) p c
$1 = {m = {z = -9192}}
(gdb) p *c
$2 = (Member &) @0x7fffffffda20: {z = -9192}
(gdb) ptype *c
type = class Member {
  public:
    int z;
} &

(gdb) p &*c
$3 = (Member *) 0x7fffffffda20

(gdb) ptype &*c
type = class Member {
  public:
    int z;
} &*
(gdb)

Notice that last print (&*c) on says the type is a pointer - that's
how you get the address behind a reference.  But notice the last ptype
instead says the type of the same expression is a pointer _reference_.
This looks like a bug to me.

This patch fixes it.  The issue is that we're entering the VALUE_LVAL
(x) == lval_memory branch by mistake for references.  The fix is just
to swap the tests so references are checked first, like value_addr
also handles references first.

Tested on x86_64 Fedora 17.

2013-02-14  Pedro Alves  <palves@redhat.com>

	* eval.c (evaluate_subexp_for_address) <default_case_after_eval,
	EVAL_AVOID_SIDE_EFFECTS>: Swap and handle TYPE_CODE_REF before
	lval_memory.

2013-02-14  Pedro Alves  <palves@redhat.com>

	* gdb.cp/userdef.exp (ptype &*c): Don't expect an &.
2013-02-14 12:43:46 +00:00
..
abstract-origin.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
abstract-origin.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ambiguous.cc
ambiguous.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
annota2.cc
annota2.exp If a breakpoint is not user visible, then there's no point in 2013-01-22 20:22:39 +00:00
annota3.cc
annota3.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
anon-ns.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
anon-ns.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
anon-struct.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
anon-struct.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
anon-union.cc
anon-union.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
arg-reference.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
arg-reference.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
baseenum.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
baseenum.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bool.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bool.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
breakpoint.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
breakpoint.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bs15503.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
bs15503.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
call-c-1.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
call-c.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
call-c.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
casts.cc PR exp/13206: 2012-07-19 15:38:18 +00:00
casts.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
class2.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
class2.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
classes.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
classes.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cmpd-minsyms.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cmpd-minsyms.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
converts.cc * gdb.cp/converts.cc (main): Initialize 'a'. 2013-01-23 20:34:22 +00:00
converts.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cp-relocate.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cp-relocate.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cpcompletion.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cpexprs.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cpexprs.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cplabel.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cplabel.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cplusfuncs.cc
cplusfuncs.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ctti.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cttiadd.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cttiadd1.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cttiadd2.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
cttiadd3.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
debug-expr.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
demangle.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
derivation.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
derivation.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
destrprint.cc
destrprint.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
dispcxx.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
dispcxx.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
exception.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
exception.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
expand-psymtabs-cxx.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
expand-psymtabs-cxx.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
expand-sals.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
expand-sals.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
extern-c.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
extern-c.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
formatted-ref.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
formatted-ref.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
fpointer.cc
fpointer.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb1355.cc
gdb1355.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb2384-base.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb2384-base.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb2384.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb2384.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb2495.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb2495.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
hang.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
hang.H
hang1.cc
hang2.cc
hang3.cc
infcall-dlopen-lib.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
infcall-dlopen.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
infcall-dlopen.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
inherit.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
koenig.cc
koenig.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
local.cc
local.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
m-data.cc
m-data.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
m-static.cc PR symtab/11464: 2013-02-12 20:27:36 +00:00
m-static.exp PR symtab/11464: 2013-02-12 20:27:36 +00:00
m-static.h
m-static1.cc
maint.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
Makefile.in
mb-ctor.cc
mb-ctor.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mb-inline.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mb-inline.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mb-inline1.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mb-inline2.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mb-templates.cc
mb-templates.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
member-name.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
member-name.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
member-ptr.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
member-ptr.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
meth-typedefs.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
meth-typedefs.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
method.cc
method.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
method2.cc
method2.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
minsym-fallback-main.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
minsym-fallback.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
minsym-fallback.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
minsym-fallback.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
misc.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
misc.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
namespace-enum-main.cc
namespace-enum.cc
namespace-enum.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
namespace-nested-import.cc
namespace-nested-import.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
namespace.cc
namespace.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
namespace1.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
nextoverthrow.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
nextoverthrow.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
no-dmgl-verbose.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
no-dmgl-verbose.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
noparam.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
noparam.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
nsdecl.cc
nsdecl.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
nsimport.cc
nsimport.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
nsnested.cc
nsnested.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
nsnoimports.cc
nsnoimports.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
nsrecurs.cc
nsrecurs.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
nsstress.cc
nsstress.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
nsusing.cc
nsusing.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
operator.cc
operator.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
oranking.cc
oranking.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
overload-const.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
overload-const.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
overload.cc
overload.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ovldbreak.cc
ovldbreak.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ovsrch.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ovsrch.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ovsrch1.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ovsrch2.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ovsrch3.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ovsrch4.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
paren-type.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
paren-type.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
parse-lang.cc gdb/ 2013-01-13 18:57:01 +00:00
parse-lang.exp gdb/ 2013-01-13 18:57:01 +00:00
pass-by-ref.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pass-by-ref.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pr-574.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pr-574.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pr-1023.cc
pr-1023.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pr-1210.cc
pr-1210.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pr9067.cc
pr9067.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pr9167.cc
pr9167.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pr9594.cc
pr9631.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pr9631.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pr10687.cc
pr10687.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pr10728-x.cc
pr10728-x.h
pr10728-y.cc
pr10728.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pr12028.cc
pr12028.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
printmethod.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
printmethod.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
psmang.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
psmang1.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
psmang2.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
psymtab-parameter.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
psymtab-parameter.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ptype-cv-cp.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ptype-cv-cp.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ptype-flags.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ptype-flags.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
punctuator.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
re-set-overloaded.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
re-set-overloaded.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
readnow-language.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
readnow-language.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ref-params.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ref-params.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ref-types.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ref-types.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
rtti.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
rtti.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
rtti1.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
rtti2.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
shadow.cc
shadow.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
smartp.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
smartp.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
static-method.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
static-method.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
static-print-quit.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
static-print-quit.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
temargs.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
temargs.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
templates.cc
templates.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
try_catch.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
try_catch.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
typedef-operator.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
typedef-operator.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
userdef.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
userdef.exp Fix ptype bug actually exercised in userdef.exp 2013-02-14 12:43:46 +00:00
using-crash.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
using-crash.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
virtbase.cc
virtbase.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
virtfunc.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
virtfunc.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
virtfunc2.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
virtfunc2.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00