public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* target/9908: wrong code generated for virtual method call (gas bug?)
@ 2003-03-02 22:46 kfoltman
  0 siblings, 0 replies; only message in thread
From: kfoltman @ 2003-03-02 22:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9908
>Category:       target
>Synopsis:       wrong code generated for virtual method call (gas bug?)
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 02 22:46:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Krzysztof Foltman
>Release:        gcc-3.2.2
>Organization:
>Environment:
Debian-x86, mingw - both give same effect
>Description:
Wrong call type is generated in -masm=intel mode. I'm not sure, but it looks like the .S file contains correct call (call dword ptr label+8), but it's assembled as near jump (E8 08 00 00 00) instead of indirect jump (FF 15 08 00 00 00). Checked by compiling both AT&T and Intel versions with -S, assembling with as and unassembling with ndisasmw.
>How-To-Repeat:
========== cut =======================

struct B {
  virtual int foo() { }
};

void check(void *pV)
{
  ((B *)pV)->foo();
}

int main(int argc, char *argv)
{
  B b;
  check((B *)&b);
}

========== cut =======================

# gcc-3.2 -O3 -masm=att -o inh inh.cpp -l stdc++ && ./inh
(this works)

# gcc-3.2 -O3 -masm=intel -o inh inh.cpp -l stdc++ && ./inh
(this segfaults)

100% repeatable both on mingw and debian gcc-3.2
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-02 22:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-02 22:46 target/9908: wrong code generated for virtual method call (gas bug?) kfoltman

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).