public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/45127]  New: Out-of-order execution
@ 2010-07-29 13:10 aleksazr at gmail dot com
  2010-07-29 13:13 ` [Bug c/45127] " aleksazr at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: aleksazr at gmail dot com @ 2010-07-29 13:10 UTC (permalink / raw)
  To: gcc-bugs

This program is written for AT91SAM9260.
It is on compiled with yagarto with GCC 4.5.0.
on win xp sp2.

The prog reads 10 dwords from
address 0 and sends them through uart.

Adress 0 (on '9260) can either be ROM or SRAM,
depending on REMAP settings.

The prog first does a REMAP, then reads 10 dwords.

However, generated code first reads ptr[0],
does REMAP, then reads ptr[1-9], which means
that the first dword will be read from ROM,
and all others from SRAM.

"MATRIX_MRCR" is volatile, so it should be
executed first, IMHO.

It can be fixed by:

1. add volatile to ptr definition (line 31).

2. instead of linking with libarm.a, 
   change lines 7 (#if 1) and 40 (SendDword2).
   This method, however, produces less readable LSS file.

I've included two LSS files: original.lss and method2.lss
Original.lss is generated with the "as is" src.c.
Methot2.lss  is generated after changing lines 7 & 40.


-- 
           Summary: Out-of-order execution
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aleksazr at gmail dot com


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


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

* [Bug c/45127] Out-of-order execution
  2010-07-29 13:10 [Bug c/45127] New: Out-of-order execution aleksazr at gmail dot com
@ 2010-07-29 13:13 ` aleksazr at gmail dot com
  2010-07-29 13:30 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: aleksazr at gmail dot com @ 2010-07-29 13:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from aleksazr at gmail dot com  2010-07-29 13:13 -------
Created an attachment (id=21348)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21348&action=view)
all sources

unpack to c:\ so that you have c:\00 folder


-- 


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


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

* [Bug c/45127] Out-of-order execution
  2010-07-29 13:10 [Bug c/45127] New: Out-of-order execution aleksazr at gmail dot com
  2010-07-29 13:13 ` [Bug c/45127] " aleksazr at gmail dot com
@ 2010-07-29 13:30 ` rguenth at gcc dot gnu dot org
  2010-07-29 14:56 ` [Bug target/45127] " aleksazr at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-29 13:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2010-07-29 13:30 -------
rar is not a portable archive format.  Please use tar instead together with
gzip (or zip).

You might want to try -fno-delete-null-pointer-checks.


-- 


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


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

* [Bug target/45127] Out-of-order execution
  2010-07-29 13:10 [Bug c/45127] New: Out-of-order execution aleksazr at gmail dot com
  2010-07-29 13:13 ` [Bug c/45127] " aleksazr at gmail dot com
  2010-07-29 13:30 ` rguenth at gcc dot gnu dot org
@ 2010-07-29 14:56 ` aleksazr at gmail dot com
  2010-07-29 16:29 ` rearnsha at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: aleksazr at gmail dot com @ 2010-07-29 14:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from aleksazr at gmail dot com  2010-07-29 14:56 -------
Created an attachment (id=21351)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21351&action=view)
all sources


-- 

aleksazr at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #21348|0                           |1
        is obsolete|                            |


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


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

* [Bug target/45127] Out-of-order execution
  2010-07-29 13:10 [Bug c/45127] New: Out-of-order execution aleksazr at gmail dot com
                   ` (2 preceding siblings ...)
  2010-07-29 14:56 ` [Bug target/45127] " aleksazr at gmail dot com
@ 2010-07-29 16:29 ` rearnsha at gcc dot gnu dot org
  2010-07-29 19:19 ` aleksazr at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2010-07-29 16:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rearnsha at gcc dot gnu dot org  2010-07-29 16:29 -------
Volatile alone won't prevent re-ordering of non-volatile memory operations. 
The volatile keyword only applies to that particular location (requiring the
compiler not to remove it, or change the number of accesses).

In this case you need to emit a memory barrier to prevent the compiler from
re-arranging the code.

A simple way to do this is to create an empty asm block that clobbers memory,
for example:

   asm  ("" : : : "memory");

this will cause the compiler to force out all pending memory operations before
the barrier and not to move later operations earlier.


-- 

rearnsha at gcc dot gnu dot org changed:

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


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


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

* [Bug target/45127] Out-of-order execution
  2010-07-29 13:10 [Bug c/45127] New: Out-of-order execution aleksazr at gmail dot com
                   ` (3 preceding siblings ...)
  2010-07-29 16:29 ` rearnsha at gcc dot gnu dot org
@ 2010-07-29 19:19 ` aleksazr at gmail dot com
  2010-07-30 13:56 ` aleksazr at gmail dot com
  2010-07-30 14:00 ` aleksazr at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: aleksazr at gmail dot com @ 2010-07-29 19:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from aleksazr at gmail dot com  2010-07-29 19:19 -------
Thank you for a good explanation. Cheers!


-- 


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


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

* [Bug target/45127] Out-of-order execution
  2010-07-29 13:10 [Bug c/45127] New: Out-of-order execution aleksazr at gmail dot com
                   ` (4 preceding siblings ...)
  2010-07-29 19:19 ` aleksazr at gmail dot com
@ 2010-07-30 13:56 ` aleksazr at gmail dot com
  2010-07-30 14:00 ` aleksazr at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: aleksazr at gmail dot com @ 2010-07-30 13:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from aleksazr at gmail dot com  2010-07-30 13:56 -------
Anyway, the files can be used to generate poor listings,
and that is also a bug. See method2.lss


-- 

aleksazr at gmail dot com changed:

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


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


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

* [Bug target/45127] Out-of-order execution
  2010-07-29 13:10 [Bug c/45127] New: Out-of-order execution aleksazr at gmail dot com
                   ` (5 preceding siblings ...)
  2010-07-30 13:56 ` aleksazr at gmail dot com
@ 2010-07-30 14:00 ` aleksazr at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: aleksazr at gmail dot com @ 2010-07-30 14:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from aleksazr at gmail dot com  2010-07-30 14:00 -------
Poor listings = listings without debug info.


-- 


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


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

end of thread, other threads:[~2010-07-30 14:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-29 13:10 [Bug c/45127] New: Out-of-order execution aleksazr at gmail dot com
2010-07-29 13:13 ` [Bug c/45127] " aleksazr at gmail dot com
2010-07-29 13:30 ` rguenth at gcc dot gnu dot org
2010-07-29 14:56 ` [Bug target/45127] " aleksazr at gmail dot com
2010-07-29 16:29 ` rearnsha at gcc dot gnu dot org
2010-07-29 19:19 ` aleksazr at gmail dot com
2010-07-30 13:56 ` aleksazr at gmail dot com
2010-07-30 14:00 ` aleksazr at gmail dot com

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