AVR C Runtime Library - Bugs: bug #14616, definition of sei() in...
You are not allowed to post comments on this tracker with your current authentication level.
bug #14616: definition of sei() in interrupts.h is faulty
Submitter: | None | ||
Submitted: | Thu 22 Sep 2005 02:59:58 PM UTC | ||
Category: | Header | Severity: | 3 - Normal |
Priority: | 5 - Normal | Item Group: | None |
Status: | Invalid | Assigned to: | None |
Percent Complete: | 0% | Originator Email: | -email is unavailable- |
Open/Closed: | Closed | Release: | None |
Fixed Release: | None |
Jump to the original submission
Sat 01 Oct 2005 05:50:54 PM UTC, comment #6: |
Anonymous |
Mon 26 Sep 2005 02:54:55 PM UTC, comment #5: The unfortunate thing is, that using volatile is not enough. Even if it works for your extremely simple test case: I am having a more complex test case example in my application code, where it does not work because gcc reorders the statements. And so as I understand the specification of gcc's inline asm statement, gcc has completely the right to reorder the statements as long as we do not communicate the possible side effects.
|
Anonymous |
Sat 24 Sep 2005 03:06:12 AM UTC, comment #4: Qualificator 'volatile' works fine in the above example. |
Anonymous |
Fri 23 Sep 2005 06:44:50 AM UTC, comment #3: Dimitry wrote:
|
Anonymous |
Fri 23 Sep 2005 03:07:19 AM UTC, comment #2: This addition will worsen quality of a code. Look an example: |
Anonymous |
Thu 22 Sep 2005 03:02:20 PM UTC, comment #1: BTW the variable in memory was declared volatile. |
Anonymous |
Thu 22 Sep 2005 02:59:58 PM UTC, original submission:
Hi,
|
Anonymous |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
Follow 3 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2005-10-06 | aesok | Status | None | Invalid | |
Open/Closed | Open | Closed | |||
2005-09-22 | None | Carbon-Copy | - | Added bjoern --PUNKT-- haase --AT-- de --PUNKT-- bosch --PUNKT-- com |
Powered by Savane 3.13-02a9.
Corresponding source code
Joerg Wunsch wrote on Montag, 26. September 2005 21:04 :
I've opened a bug report on
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24165
. Probably it's indeed a bug in gcc 4.0.0 that is already fixed in gcc 4.0.1 !
Here is the reduced test case:
/* Start of test case */
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
class class_with_volatile_data_structures
{
public:
void _attribute_ ((always_inline))
wait_for_event (uint16_t event)
{
while (getval_protected () != event)
;
};
private:
uint16_t
getval_protected (void)
{
uint16_t result;
asm volatile ("/* disable irq in cpu status */" : : );
result = class_local_data;
asm volatile ("/* enable irq */" : : );
return result;
}
volatile uint16_t class_local_data;
};
class_with_volatile_data_structures object;
void
wait_for_42 (void)
{
object.wait_for_event (42);
}
/* End of test case */
Compiler output reads for (buggy ?) avr-g++ (GCC) 4.0.0
_Z11wait_for_42v:
.L2:
/* #APP */
/* disable irq in cpu status */
/* enable irq */
/* #NOAPP */
lds r24,object
lds r25,(object)+1
sbiw r24,42
brne .L2
ret
and for avr-g++ (GCC) 4.0.1 20050624 (prerelease)
_Z11wait_for_42v:
.L2:
/* #APP */
/* disable irq in cpu status */
/* #NOAPP */
lds r24,object
lds r25,(object)+1
/* #APP */
/* enable irq */
/* #NOAPP */
sbiw r24,42
brne .L2
ret