public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/17565] New: asms in delay slots
@ 2004-09-20  6:43 rsandifo at gcc dot gnu dot org
  2004-09-20  6:43 ` [Bug target/17565] " rsandifo at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2004-09-20  6:43 UTC (permalink / raw)
  To: gcc-bugs

The MIPS port allows asms to be put into delay slots if the
compiler guesses they are only one instruction long.  This is
wrong because of the possibiltiy of it containing macros.

The problem can be reproduced as an assembler warning
in the following testcase:

int foo (int n)
{
  register int k asm ("$16") = n;
  if (k > 0)
    {
      bar ();
      asm ("li %0,0x12345678" : "=r" (k));
    }
  return k;
}

because the multi-instruction asm statement goes into the delay
slot of the call to bar().

This is reduced from a much more serious linux problem.
Linux is fond of using empty asm statements, and since gcc estimates
empty asms to be one instruction long, they too might be put into
delay slots.  This actually has the effect of putting the following
instruction into the delay slot instead.  Since there's no assembler
warning, the problem was only detected as a run-time failure.

This problem goes back to at least 2.95.

Richard

-- 
           Summary: asms in delay slots
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rsandifo at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: mips64-elf


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


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

* [Bug target/17565] asms in delay slots
  2004-09-20  6:43 [Bug target/17565] New: asms in delay slots rsandifo at gcc dot gnu dot org
@ 2004-09-20  6:43 ` rsandifo at gcc dot gnu dot org
  2004-09-20  6:54 ` cvs-commit at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2004-09-20  6:43 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rsandifo at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED


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


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

* [Bug target/17565] asms in delay slots
  2004-09-20  6:43 [Bug target/17565] New: asms in delay slots rsandifo at gcc dot gnu dot org
  2004-09-20  6:43 ` [Bug target/17565] " rsandifo at gcc dot gnu dot org
@ 2004-09-20  6:54 ` cvs-commit at gcc dot gnu dot org
  2004-09-20  7:00 ` rsandifo at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-09-20  6:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-09-20 06:54 -------
Subject: Bug 17565

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rsandifo@gcc.gnu.org	2004-09-20 06:54:53

Modified files:
	gcc            : ChangeLog 
	gcc/testsuite  : ChangeLog 
	gcc/config/mips: mips.md 
Added files:
	gcc/testsuite/gcc.target/mips: asm-1.c 

Log message:
	PR target/17565
	* config/mips/mips.md (define_asm_attributes): Set can_delay to no.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5526&r2=2.5527
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4316&r2=1.4317
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.target/mips/asm-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/mips/mips.md.diff?cvsroot=gcc&r1=1.306&r2=1.307



-- 


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


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

* [Bug target/17565] asms in delay slots
  2004-09-20  6:43 [Bug target/17565] New: asms in delay slots rsandifo at gcc dot gnu dot org
  2004-09-20  6:43 ` [Bug target/17565] " rsandifo at gcc dot gnu dot org
  2004-09-20  6:54 ` cvs-commit at gcc dot gnu dot org
@ 2004-09-20  7:00 ` rsandifo at gcc dot gnu dot org
  2004-09-20 12:57 ` [Bug target/17565] [3.4 only] " pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2004-09-20  7:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rsandifo at gcc dot gnu dot org  2004-09-20 07:00 -------
Mark, is this OK for 3.4?  Patch is here:

    http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01905.html

As I said in the message:

    This problem goes back to at least 2.95, so it isn't technically a
    regression.  On the other hand, it's the kind of bug that could trigger
    for different types of code in different releases, so I'm sure there's
    a testcase that fails (say) in 3.4 and not in 2.95.

The bug is known to cause wrong-code problems in linux and the patch
is very simple and (IMO) very low risk.

Richard


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmitchel at gcc dot gnu dot
                   |                            |org


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


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

* [Bug target/17565] [3.4 only] asms in delay slots
  2004-09-20  6:43 [Bug target/17565] New: asms in delay slots rsandifo at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-09-20  7:00 ` rsandifo at gcc dot gnu dot org
@ 2004-09-20 12:57 ` pinskia at gcc dot gnu dot org
  2004-09-20 12:59 ` rsandifo at redhat dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-20 12:57 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |3.4.0
      Known to work|                            |4.0.0
            Summary|asms in delay slots         |[3.4 only] asms in delay
                   |                            |slots
   Target Milestone|---                         |3.4.3


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


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

* [Bug target/17565] [3.4 only] asms in delay slots
  2004-09-20  6:43 [Bug target/17565] New: asms in delay slots rsandifo at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-09-20 12:57 ` [Bug target/17565] [3.4 only] " pinskia at gcc dot gnu dot org
@ 2004-09-20 12:59 ` rsandifo at redhat dot com
  2004-09-20 14:36 ` mark at codesourcery dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rsandifo at redhat dot com @ 2004-09-20 12:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rsandifo at redhat dot com  2004-09-20 12:59 -------
Subject: Re:  [3.4 only] asms in delay slots

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
>             Summary|asms in delay slots         |[3.4 only] asms in delay
>                    |                            |slots

That's very misleading.  As I said in the text, it's everything
from 2.95, including 3.3.x.

Richard


-- 


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


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

* [Bug target/17565] [3.4 only] asms in delay slots
  2004-09-20  6:43 [Bug target/17565] New: asms in delay slots rsandifo at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-09-20 12:59 ` rsandifo at redhat dot com
@ 2004-09-20 14:36 ` mark at codesourcery dot com
  2004-09-20 15:27 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mark at codesourcery dot com @ 2004-09-20 14:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mark at codesourcery dot com  2004-09-20 14:35 -------
Subject: Re:  asms in delay slots

rsandifo at gcc dot gnu dot org wrote:

>------- Additional Comments From rsandifo at gcc dot gnu dot org  2004-09-20 07:00 -------
>Mark, is this OK for 3.4?  Patch is here:
>
>    http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01905.html
>
>As I said in the message:
>
>    This problem goes back to at least 2.95, so it isn't technically a
>    regression.  On the other hand, it's the kind of bug that could trigger
>    for different types of code in different releases, so I'm sure there's
>    a testcase that fails (say) in 3.4 and not in 2.95.
>
>The bug is known to cause wrong-code problems in linux and the patch
>is very simple and (IMO) very low risk.
>  
>
Yes, this is OK for 3.4.3.



-- 


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


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

* [Bug target/17565] [3.4 only] asms in delay slots
  2004-09-20  6:43 [Bug target/17565] New: asms in delay slots rsandifo at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-09-20 14:36 ` mark at codesourcery dot com
@ 2004-09-20 15:27 ` cvs-commit at gcc dot gnu dot org
  2004-09-22 21:26 ` [Bug target/17565] [3.3 " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-09-20 15:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-09-20 15:27 -------
Subject: Bug 17565

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	rsandifo@gcc.gnu.org	2004-09-20 15:27:29

Modified files:
	gcc            : ChangeLog 
	gcc/config/mips: mips.md 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: mips-asm-1.c 

Log message:
	PR target/17565
	* config/mips/mips.md (define_asm_attributes): Set can_delay to no.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.628&r2=2.2326.2.629
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/mips/mips.md.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.211.4.7&r2=1.211.4.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.269&r2=1.3389.2.270
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/mips-asm-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug target/17565] [3.3 only] asms in delay slots
  2004-09-20  6:43 [Bug target/17565] New: asms in delay slots rsandifo at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2004-09-20 15:27 ` cvs-commit at gcc dot gnu dot org
@ 2004-09-22 21:26 ` pinskia at gcc dot gnu dot org
  2004-09-28 13:41 ` gdr at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-22 21:26 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.3                       |3.3.5


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


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

* [Bug target/17565] [3.3 only] asms in delay slots
  2004-09-20  6:43 [Bug target/17565] New: asms in delay slots rsandifo at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2004-09-22 21:26 ` [Bug target/17565] [3.3 " pinskia at gcc dot gnu dot org
@ 2004-09-28 13:41 ` gdr at gcc dot gnu dot org
  2005-01-08 14:11 ` cvs-commit at gcc dot gnu dot org
  2005-01-08 14:14 ` rsandifo at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-09-28 13:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at gcc dot gnu dot org  2004-09-28 13:40 -------
Adjust milestone

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.3.5                       |3.3.6


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


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

* [Bug target/17565] [3.3 only] asms in delay slots
  2004-09-20  6:43 [Bug target/17565] New: asms in delay slots rsandifo at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2004-09-28 13:41 ` gdr at gcc dot gnu dot org
@ 2005-01-08 14:11 ` cvs-commit at gcc dot gnu dot org
  2005-01-08 14:14 ` rsandifo at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-01-08 14:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-01-08 14:11 -------
Subject: Bug 17565

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	rsandifo@gcc.gnu.org	2005-01-08 14:11:15

Modified files:
	gcc            : ChangeLog 
	gcc/config/mips: mips.md 

Log message:
	PR target/17565
	* config/mips/mips.md (define_asm_attributes): Set can_delay to no.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.1048&r2=1.16114.2.1049
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/mips/mips.md.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.153.2.5&r2=1.153.2.6



-- 


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


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

* [Bug target/17565] [3.3 only] asms in delay slots
  2004-09-20  6:43 [Bug target/17565] New: asms in delay slots rsandifo at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2005-01-08 14:11 ` cvs-commit at gcc dot gnu dot org
@ 2005-01-08 14:14 ` rsandifo at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2005-01-08 14:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rsandifo at gcc dot gnu dot org  2005-01-08 14:14 -------
Fixed for 3.3.6

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|4.0.0 3.4.0                 |4.0.0 3.4.0 3.3.6
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2005-01-08 14:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-20  6:43 [Bug target/17565] New: asms in delay slots rsandifo at gcc dot gnu dot org
2004-09-20  6:43 ` [Bug target/17565] " rsandifo at gcc dot gnu dot org
2004-09-20  6:54 ` cvs-commit at gcc dot gnu dot org
2004-09-20  7:00 ` rsandifo at gcc dot gnu dot org
2004-09-20 12:57 ` [Bug target/17565] [3.4 only] " pinskia at gcc dot gnu dot org
2004-09-20 12:59 ` rsandifo at redhat dot com
2004-09-20 14:36 ` mark at codesourcery dot com
2004-09-20 15:27 ` cvs-commit at gcc dot gnu dot org
2004-09-22 21:26 ` [Bug target/17565] [3.3 " pinskia at gcc dot gnu dot org
2004-09-28 13:41 ` gdr at gcc dot gnu dot org
2005-01-08 14:11 ` cvs-commit at gcc dot gnu dot org
2005-01-08 14:14 ` rsandifo 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).