public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/11772] New: Incorrect code generated with -mrtd and long long
@ 2003-08-02 17:11 mikulas at artax dot karlin dot mff dot cuni dot cz
  2003-08-02 17:16 ` [Bug c/11772] " pinskia at physics dot uc dot edu
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mikulas at artax dot karlin dot mff dot cuni dot cz @ 2003-08-02 17:11 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Incorrect code generated with -mrtd and long long
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mikulas at artax dot karlin dot mff dot cuni dot cz
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i586-pc-linux-gnu
  GCC host triplet: i586-pc-linux-gnu
GCC target triplet: i586-pc-linux-gnu

When using gcc in an environment where -mrtd is default calling convention, gcc calls long long operations like __divdi3 without -mrtd (on the other hand, it honours -mregparm when calling these functions). The resulting code crashes, because stack is incremented twice --- once at the end of __divdi3 and next after return to calling function.


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

* [Bug c/11772] Incorrect code generated with -mrtd and long long
  2003-08-02 17:11 [Bug c/11772] New: Incorrect code generated with -mrtd and long long mikulas at artax dot karlin dot mff dot cuni dot cz
@ 2003-08-02 17:16 ` pinskia at physics dot uc dot edu
  2003-08-02 17:17 ` mikulas at artax dot karlin dot mff dot cuni dot cz
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-02 17:16 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code


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

* [Bug c/11772] Incorrect code generated with -mrtd and long long
  2003-08-02 17:11 [Bug c/11772] New: Incorrect code generated with -mrtd and long long mikulas at artax dot karlin dot mff dot cuni dot cz
  2003-08-02 17:16 ` [Bug c/11772] " pinskia at physics dot uc dot edu
@ 2003-08-02 17:17 ` mikulas at artax dot karlin dot mff dot cuni dot cz
  2003-08-02 17:21 ` pinskia at physics dot uc dot edu
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mikulas at artax dot karlin dot mff dot cuni dot cz @ 2003-08-02 17:17 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


mikulas at artax dot karlin dot mff dot cuni dot cz changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|wrong-code                  |


------- Additional Comments From mikulas at artax dot karlin dot mff dot cuni dot cz  2003-08-02 17:17 -------
This is test code for the bug:

long long __divdi3(long long a, long long b)
{
        return a + b;
}

f()
{
        volatile int x = 1;
        long long a1 = 4, a2 = 2;
        /*long long a = __divdi3(a1, a2);*/
        long long a = a1 / a2;
        if (x != 1) abort();
        return a;
}

main()
{
        return f();
}

compile it with -fomit-frame-pointer -mrtd flags. When you run it, it fails in Abort function, because value of variable `x' changed because stack pointer is incorrect in function f.

When you look at assembler, you see that __divdi3 exits with ret $16 and there's additional addl $16, %esp after calling __divdi3.

Mikulas


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

* [Bug c/11772] Incorrect code generated with -mrtd and long long
  2003-08-02 17:11 [Bug c/11772] New: Incorrect code generated with -mrtd and long long mikulas at artax dot karlin dot mff dot cuni dot cz
  2003-08-02 17:16 ` [Bug c/11772] " pinskia at physics dot uc dot edu
  2003-08-02 17:17 ` mikulas at artax dot karlin dot mff dot cuni dot cz
@ 2003-08-02 17:21 ` pinskia at physics dot uc dot edu
  2003-08-05 14:43 ` pinskia at physics dot uc dot edu
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-02 17:21 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code


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

* [Bug c/11772] Incorrect code generated with -mrtd and long long
  2003-08-02 17:11 [Bug c/11772] New: Incorrect code generated with -mrtd and long long mikulas at artax dot karlin dot mff dot cuni dot cz
                   ` (2 preceding siblings ...)
  2003-08-02 17:21 ` pinskia at physics dot uc dot edu
@ 2003-08-05 14:43 ` pinskia at physics dot uc dot edu
  2003-08-23  1:07 ` [Bug target/11772] " dhazeghi at yahoo dot com
  2003-11-23  7:14 ` [Bug target/11772] Incorrect code generated with -mrtd and long long (most builtins) pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-05 14:43 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-05 14:43:14
               date|                            |


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-05 14:43 -------
I can confirm this on the mainline (20030805).


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

* [Bug target/11772] Incorrect code generated with -mrtd and long long
  2003-08-02 17:11 [Bug c/11772] New: Incorrect code generated with -mrtd and long long mikulas at artax dot karlin dot mff dot cuni dot cz
                   ` (3 preceding siblings ...)
  2003-08-05 14:43 ` pinskia at physics dot uc dot edu
@ 2003-08-23  1:07 ` dhazeghi at yahoo dot com
  2003-11-23  7:14 ` [Bug target/11772] Incorrect code generated with -mrtd and long long (most builtins) pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-23  1:07 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


dhazeghi at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |---


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

* [Bug target/11772] Incorrect code generated with -mrtd and long long (most builtins)
  2003-08-02 17:11 [Bug c/11772] New: Incorrect code generated with -mrtd and long long mikulas at artax dot karlin dot mff dot cuni dot cz
                   ` (4 preceding siblings ...)
  2003-08-23  1:07 ` [Bug target/11772] " dhazeghi at yahoo dot com
@ 2003-11-23  7:14 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-23  7:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-23 07:14 -------
Most likely the same bug as PR 12769.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2003-08-05 14:43:14         |2003-11-23 07:14:41
               date|                            |
            Summary|Incorrect code generated    |Incorrect code generated
                   |with -mrtd and long long    |with -mrtd and long long
                   |                            |(most builtins)


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


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

end of thread, other threads:[~2003-11-23  7:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-02 17:11 [Bug c/11772] New: Incorrect code generated with -mrtd and long long mikulas at artax dot karlin dot mff dot cuni dot cz
2003-08-02 17:16 ` [Bug c/11772] " pinskia at physics dot uc dot edu
2003-08-02 17:17 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2003-08-02 17:21 ` pinskia at physics dot uc dot edu
2003-08-05 14:43 ` pinskia at physics dot uc dot edu
2003-08-23  1:07 ` [Bug target/11772] " dhazeghi at yahoo dot com
2003-11-23  7:14 ` [Bug target/11772] Incorrect code generated with -mrtd and long long (most builtins) pinskia at gcc dot gnu dot org

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