public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/34177]  New: Inline assembly uses wrong register
@ 2007-11-21 17:51 pete at highdesertsoftware dot net
  2007-11-21 17:53 ` [Bug c/34177] " pete at highdesertsoftware dot net
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: pete at highdesertsoftware dot net @ 2007-11-21 17:51 UTC (permalink / raw)
  To: gcc-bugs

asm volatile("mov       r25, %0" : "=r" (RunTsk));
Selects the incorrect register for the move.


-- 
           Summary: Inline assembly uses wrong register
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pete at highdesertsoftware dot net
  GCC host triplet: Windows
GCC target triplet: AVR (WinAVR)


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


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

* [Bug c/34177] Inline assembly uses wrong register
  2007-11-21 17:51 [Bug c/34177] New: Inline assembly uses wrong register pete at highdesertsoftware dot net
@ 2007-11-21 17:53 ` pete at highdesertsoftware dot net
  2007-11-21 17:53 ` pete at highdesertsoftware dot net
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pete at highdesertsoftware dot net @ 2007-11-21 17:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pete at highdesertsoftware dot net  2007-11-21 17:53 -------
Created an attachment (id=14594)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14594&action=view)
Standard out from make


-- 


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


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

* [Bug c/34177] Inline assembly uses wrong register
  2007-11-21 17:51 [Bug c/34177] New: Inline assembly uses wrong register pete at highdesertsoftware dot net
  2007-11-21 17:53 ` [Bug c/34177] " pete at highdesertsoftware dot net
@ 2007-11-21 17:53 ` pete at highdesertsoftware dot net
  2007-11-21 17:54 ` pete at highdesertsoftware dot net
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pete at highdesertsoftware dot net @ 2007-11-21 17:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pete at highdesertsoftware dot net  2007-11-21 17:53 -------
Created an attachment (id=14595)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14595&action=view)
Standard error from make


-- 


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


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

* [Bug c/34177] Inline assembly uses wrong register
  2007-11-21 17:51 [Bug c/34177] New: Inline assembly uses wrong register pete at highdesertsoftware dot net
  2007-11-21 17:53 ` [Bug c/34177] " pete at highdesertsoftware dot net
  2007-11-21 17:53 ` pete at highdesertsoftware dot net
@ 2007-11-21 17:54 ` pete at highdesertsoftware dot net
  2007-11-21 17:57 ` pete at highdesertsoftware dot net
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pete at highdesertsoftware dot net @ 2007-11-21 17:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pete at highdesertsoftware dot net  2007-11-21 17:54 -------
Created an attachment (id=14596)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14596&action=view)
Preprocessor output


-- 


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


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

* [Bug c/34177] Inline assembly uses wrong register
  2007-11-21 17:51 [Bug c/34177] New: Inline assembly uses wrong register pete at highdesertsoftware dot net
                   ` (2 preceding siblings ...)
  2007-11-21 17:54 ` pete at highdesertsoftware dot net
@ 2007-11-21 17:57 ` pete at highdesertsoftware dot net
  2007-11-21 18:06 ` [Bug inline-asm/34177] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pete at highdesertsoftware dot net @ 2007-11-21 17:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pete at highdesertsoftware dot net  2007-11-21 17:57 -------
Created an attachment (id=14597)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14597&action=view)
Fragment from the lss file

This shows a mix is c and assembly showing where the incorrect register is used
in the mov statement.


-- 


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


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

* [Bug inline-asm/34177] Inline assembly uses wrong register
  2007-11-21 17:51 [Bug c/34177] New: Inline assembly uses wrong register pete at highdesertsoftware dot net
                   ` (3 preceding siblings ...)
  2007-11-21 17:57 ` pete at highdesertsoftware dot net
@ 2007-11-21 18:06 ` pinskia at gcc dot gnu dot org
  2007-11-21 20:38 ` pete at highdesertsoftware dot net
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-21 18:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2007-11-21 18:06 -------
r25 is not marked as clobbered so what do you expect?
Try:
asm volatile("mov       r25, %0" : "=r" (RunTsk)::"r25");


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c                           |inline-asm
         Resolution|                            |INVALID


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


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

* [Bug inline-asm/34177] Inline assembly uses wrong register
  2007-11-21 17:51 [Bug c/34177] New: Inline assembly uses wrong register pete at highdesertsoftware dot net
                   ` (4 preceding siblings ...)
  2007-11-21 18:06 ` [Bug inline-asm/34177] " pinskia at gcc dot gnu dot org
@ 2007-11-21 20:38 ` pete at highdesertsoftware dot net
  2007-11-21 20:42 ` pinskia at gcc dot gnu dot org
  2007-11-21 21:01 ` pete at highdesertsoftware dot net
  7 siblings, 0 replies; 9+ messages in thread
From: pete at highdesertsoftware dot net @ 2007-11-21 20:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pete at highdesertsoftware dot net  2007-11-21 20:38 -------
Subject: Re:  Inline assembly uses wrong register

Thank you for your exceptionally fast response.  However, adding the 
clobber did not help.  The problem, I think, is r19 is used as the local 
variable "RunTsk", yet r24 is what gets moved to r25.  I guess I didn't 
make clear what the problem was.
Another fagment from the lss file. 


    if (RunTsk < gRunningIdx)
     64a:    80 91 cc 04     lds    r24, 0x04CC
     64e:    38 17           cp    r19, r24
     650:    10 f4           brcc    .+4          ; 0x656 <HDStos_Tick+0x64>
    {
        /* Pass the new thread index in r25 */

        asm volatile("mov    r25, %0" : "=r" (RunTsk)::"r25");
     652:    98 2f           mov    r25, r24
        asm volatile("rjmp hdstos_Switch");
     654:    87 cf           rjmp    .-242        ; 0x564 <hdstos_Switch>
    }

Thanks
-Pete


pinskia at gcc dot gnu dot org wrote:
> ------- Comment #5 from pinskia at gcc dot gnu dot org  2007-11-21 18:06 -------
> r25 is not marked as clobbered so what do you expect?
> Try:
> asm volatile("mov       r25, %0" : "=r" (RunTsk)::"r25");
>
>
>   


-- 


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


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

* [Bug inline-asm/34177] Inline assembly uses wrong register
  2007-11-21 17:51 [Bug c/34177] New: Inline assembly uses wrong register pete at highdesertsoftware dot net
                   ` (5 preceding siblings ...)
  2007-11-21 20:38 ` pete at highdesertsoftware dot net
@ 2007-11-21 20:42 ` pinskia at gcc dot gnu dot org
  2007-11-21 21:01 ` pete at highdesertsoftware dot net
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-21 20:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2007-11-21 20:42 -------
Oh you are not storing to RunTsk but to r25 so your constraints are incorrect
still.
Try:
asm volatile("mov       r25, %0" : : "r" (RunTsk):"r25");

This still makes the bug invalid.


-- 


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


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

* [Bug inline-asm/34177] Inline assembly uses wrong register
  2007-11-21 17:51 [Bug c/34177] New: Inline assembly uses wrong register pete at highdesertsoftware dot net
                   ` (6 preceding siblings ...)
  2007-11-21 20:42 ` pinskia at gcc dot gnu dot org
@ 2007-11-21 21:01 ` pete at highdesertsoftware dot net
  7 siblings, 0 replies; 9+ messages in thread
From: pete at highdesertsoftware dot net @ 2007-11-21 21:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pete at highdesertsoftware dot net  2007-11-21 21:01 -------
Subject: Re:  Inline assembly uses wrong register

Thank you so much.  That fixed it.  Sorry to bother you with user error. 

It worked in 3.4.6, the last version of WinAVR I installed, that is why 
I assumed a bug.

I've read and re-read about inline assembler and I just don't get it.  
Is there a place with tons and tons of examples?
Thanks again.
-Pete


pinskia at gcc dot gnu dot org wrote:
> ------- Comment #7 from pinskia at gcc dot gnu dot org  2007-11-21 20:42 -------
> Oh you are not storing to RunTsk but to r25 so your constraints are incorrect
> still.
> Try:
> asm volatile("mov       r25, %0" : : "r" (RunTsk):"r25");
>
> This still makes the bug invalid.
>
>
>   


-- 


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


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

end of thread, other threads:[~2007-11-21 21:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-21 17:51 [Bug c/34177] New: Inline assembly uses wrong register pete at highdesertsoftware dot net
2007-11-21 17:53 ` [Bug c/34177] " pete at highdesertsoftware dot net
2007-11-21 17:53 ` pete at highdesertsoftware dot net
2007-11-21 17:54 ` pete at highdesertsoftware dot net
2007-11-21 17:57 ` pete at highdesertsoftware dot net
2007-11-21 18:06 ` [Bug inline-asm/34177] " pinskia at gcc dot gnu dot org
2007-11-21 20:38 ` pete at highdesertsoftware dot net
2007-11-21 20:42 ` pinskia at gcc dot gnu dot org
2007-11-21 21:01 ` pete at highdesertsoftware dot net

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