public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30976]  New: generating non-conforming "rep retn" with -match=athlon, k8 ; with -masm=intel fails
@ 2007-02-27  0:19 zsojka at seznam dot cz
  2007-02-27  0:22 ` [Bug c++/30976] " pinskia at gcc dot gnu dot org
  2007-02-27  0:36 ` zsojka at seznam dot cz
  0 siblings, 2 replies; 3+ messages in thread
From: zsojka at seznam dot cz @ 2007-02-27  0:19 UTC (permalink / raw)
  To: gcc-bugs

gcc versions tested (all have this problem on both architectures):
x86_64
3.4.6 4.1.1 4.1.2

i686
3.4.6 4.1.1

Reduced testcase: main.cpp
---------------
struct o {
  virtual void a() { }
};

int main(int,char**) {
  new o();
  return 0;
}
----------------
When a() is removed or set as non-virtual, problem disappears

Commandline to fail compilation:
i686:
g++ main.cpp -o main -O -fomit-frame-pointer -march=athlon -masm=intel

x86_64:
g++ main.cpp -o main -O -masm=intel

-march of athlon, athlon-4, k8 fails
without -masm the code is compiled, but its behavior is undefined (although
working)

---------------

In assembler output, the following line appears with AT&T syntax:
        rep ; ret
and is accepted. (two independendend instructions, although meaningless)
With Intel syntax, generated code:
        rep  ret
is not accepted. (meaningless prefix)

---------------
According to Intel IA-32 documentation:
"The behavior of the REP prefix is undefined when used with non-string
instructions."
AMD AMD64 documentation:
"The (rep/repe) prefixes should only be used with such (lods,stos,movs,...)
string instructions."

---------------

I could post exact error messages and outputs of gcc -v on all tested systems
if needed (I have already done so, but the output is very long to past here)

------------

Conlusion:
Generates code non-conforming to Intel and AMD documentation. Unlikely, code
would not work on future processors. With AT&T syntax, asm code is accepted.
With Intel syntax, it is rejected.
The pair 'rep ; retn' should never appear as it is undefined when executed by
CPU. (and it most likely gets generated nonintentionally)


-- 
           Summary: generating non-conforming "rep retn" with -match=athlon,
                    k8 ; with -masm=intel fails
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zsojka at seznam dot cz
 GCC build triplet: x86_64-pc-linux-gnu i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30976


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

* [Bug c++/30976] generating non-conforming "rep retn" with -match=athlon, k8 ; with -masm=intel fails
  2007-02-27  0:19 [Bug c++/30976] New: generating non-conforming "rep retn" with -match=athlon, k8 ; with -masm=intel fails zsojka at seznam dot cz
@ 2007-02-27  0:22 ` pinskia at gcc dot gnu dot org
  2007-02-27  0:36 ` zsojka at seznam dot cz
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-27  0:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-02-27 00:22 -------


*** This bug has been marked as a duplicate of 29473 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30976


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

* [Bug c++/30976] generating non-conforming "rep retn" with -match=athlon, k8 ; with -masm=intel fails
  2007-02-27  0:19 [Bug c++/30976] New: generating non-conforming "rep retn" with -match=athlon, k8 ; with -masm=intel fails zsojka at seznam dot cz
  2007-02-27  0:22 ` [Bug c++/30976] " pinskia at gcc dot gnu dot org
@ 2007-02-27  0:36 ` zsojka at seznam dot cz
  1 sibling, 0 replies; 3+ messages in thread
From: zsojka at seznam dot cz @ 2007-02-27  0:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from zsojka at seznam dot cz  2007-02-27 00:36 -------
(In reply to comment #1)
> 
> *** This bug has been marked as a duplicate of 29473 ***
> 

Sorry, I was searching at http://gcc.gnu.org/bugzilla/query.cgi in 'Open' bugs
only. (anyway, this is another case this bug appears)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30976


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

end of thread, other threads:[~2007-02-27  0:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-27  0:19 [Bug c++/30976] New: generating non-conforming "rep retn" with -match=athlon, k8 ; with -masm=intel fails zsojka at seznam dot cz
2007-02-27  0:22 ` [Bug c++/30976] " pinskia at gcc dot gnu dot org
2007-02-27  0:36 ` zsojka at seznam dot cz

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