bugAVR C Runtime Library - Bugs: bug #37778, _MemoryBarrier() in cpufunc.h...

 
 

bug #37778: _MemoryBarrier() in cpufunc.h error on compile

Submitted by:  None
Submitted on:  Mon 19 Nov 2012 09:52:10 PM UTC  
 
Category: HeaderSeverity: 3 - Normal
Priority: 9 - ImmediateItem Group: libc code
Status: In ProgressPercent Complete: 50%
Assigned to: Dmitry Xmelkov <dmix>Originator Email: -unavailable-
Open/Closed: OpenRelease: 1.8.0
Fixed Release: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 27 Jan 2013 05:28:17 PM UTC, comment #3:

Question is whether or not NOP should be allowed to be moved across
ordinary memory moves.

For SEI and CLI, for example, I think this is not wanted in general.

NOP is less intrusive than SEI / CLI, of course, but avr-gcc emits
__builtin_avr_nop() with a memory clobber:

http://gcc.gnu.org/viewcvs/trunk/gcc/config/avr/avr.md?revision=195151&view=markup#l5938

Georg-Johann Lay <gjlayde>
Sun 27 Jan 2013 12:58:16 PM UTC, comment #2:

What is the necessity to add memory barrier for _NOP()?
Common usage, like:
PORTB |= 1;
_NOP();
PORTB &= ~1;
is safe, as hardware registers are volatile.

Dmitry Xmelkov <dmix>
Project AdministratorIn charge of this item.
Mon 19 Nov 2012 10:59:22 PM UTC, comment #1:

...and while your are fixing avr/cpufunc.h, don't forget to fix _NOP which reads:

#define NOP() __asm_ __volatile__("nop")

but should get a memory barrier:

#define NOP() __asm_ __volatile__("nop" ::: memory)

Georg-Johann Lay <gjlayde>
Mon 19 Nov 2012 09:52:10 PM UTC, original submission:

The _MemoryBarrier() macro defined in avr/cpufunc.h results in the following error when compiling:
error: expected string literal before ':' token

Currently defined as:
#define MemoryBarrier() __asm_ __volatile__(:::"memory")

Should be:
#define MemoryBarrier() __asm_ __volatile__("":::"memory")

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #30890:  pr37778.patch added by soundararajan (521B - text/x-patch - Fix, as discussed in the comments.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by soundararajan (Updated the item)
  • -unavailable- added by dmix (Posted a comment)
  • -unavailable- added by arcanum (Updated the item)
  • -unavailable- added by gjlayde (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 14 Mar 2014 05:04:30 AM UTCsoundararajanAttached File-=>Added pr37778.patch, #30890
    Sun 27 Jan 2013 12:58:16 PM UTCdmixStatusNone=>In Progress
      Percent Complete0%=>50%
      Assigned toNone=>dmix
    Tue 20 Nov 2012 02:33:29 AM UTCarcanumPriority5 - Normal=>9 - Immediate

    Back to the top


    Powered by Savane 3.1-cleanup