public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/7183: structs passed by value are corrupted
@ 2002-07-03 12:37 nathan
  0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-07-03 12:37 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, mark_a_lindner, nobody

Synopsis: structs passed by value are corrupted

State-Changed-From-To: open->analyzed
State-Changed-By: nathan
State-Changed-When: Wed Jul  3 12:37:50 2002
State-Changed-Why:
    confirmed. This is sparc specific

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7183


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/7183: structs passed by value are corrupted
@ 2002-07-01 21:16 mark_a_lindner
  0 siblings, 0 replies; 2+ messages in thread
From: mark_a_lindner @ 2002-07-01 21:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7183
>Category:       c++
>Synopsis:       structs passed by value are corrupted
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 01 21:16:03 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     mark_a_lindner@yahoo.com
>Release:        3.1
>Organization:
>Environment:
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.1/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --disable-nls
Thread model: posix
>Description:
Pass-by-value of a simple struct causes the struct to get corrupted. The attached code, when invoked as described below, produces the following output on my Solaris system:

key   = 5
value = 5
now recursing
key   = 135536
value = 70104
now recursing
key   = 16845391
value = 139112

I have not tested other scenarios (non-template, etc.)
>How-To-Repeat:

instantiate the template as follows:

BugTest<int, int> mytest(5, 5);
>Fix:

Pass-by-reference [ _Datum& key ] appears to solve the problem.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="BugTest.h"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="BugTest.h"

CnRlbXBsYXRlIDxjbGFzcyBLRVksIGNsYXNzIFRZUEU+IGNsYXNzIEJ1Z1Rlc3QKICB7CiAgcHJp
dmF0ZToKICBzdHJ1Y3QgX0RhdHVtCiAgICB7CiAgICBLRVkga2V5OwogICAgVFlQRSB2YWx1ZTsK
ICAgIH07CgogIHZvaWQgdGVzdEZ1bmMoX0RhdHVtIGRhdHVtLCBpbnQgeCk7CgogIHB1YmxpYzoK
ICBCdWdUZXN0KEtFWSBrZXksIFRZUEUgdmFsdWUpOwogIAogIH07Cgp0ZW1wbGF0ZSA8Y2xhc3Mg
S0VZLCBjbGFzcyBUWVBFPgogIEJ1Z1Rlc3Q8S0VZLCBUWVBFPjo6QnVnVGVzdChLRVkga2V5LCBU
WVBFIHZhbHVlKQogIHsKICBfRGF0dW0gdGVzdDsKCiAgdGVzdC5rZXkgPSBrZXk7CiAgdGVzdC52
YWx1ZSA9IHZhbHVlOwogIAogIHRlc3RGdW5jKHRlc3QsIDApOwogIH0KCnRlbXBsYXRlIDxjbGFz
cyBLRVksIGNsYXNzIFRZUEU+CiAgdm9pZCBCdWdUZXN0PEtFWSwgVFlQRT46OnRlc3RGdW5jKF9E
YXR1bSBrZXksIGludCBkZXB0aCkKICB7CiAgc3RkOjpjb3V0IDw8ICJrZXkgICA9ICIgPDwga2V5
LmtleSA8PCAiXG4iOwogIHN0ZDo6Y291dCA8PCAidmFsdWUgPSAiIDw8IGtleS52YWx1ZSA8PCAi
XG4iOwogIGlmKGRlcHRoIDwgMikKICAgIHsKICAgIHN0ZDo6Y291dCA8PCAibm93IHJlY3Vyc2lu
Z1xuIjsKICAgIHRlc3RGdW5jKGtleSwgKytkZXB0aCk7CiAgICB9CiAgfQoKCgo=


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-07-03 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-03 12:37 c++/7183: structs passed by value are corrupted nathan
  -- strict thread matches above, loose matches on Subject: below --
2002-07-01 21:16 mark_a_lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).