[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] [bug #56093] Wrong constraint in pgmspace.h::pgm_get_far_
From: |
Georg-Johann Lay |
Subject: |
[avr-libc-dev] [bug #56093] Wrong constraint in pgmspace.h::pgm_get_far_address |
Date: |
Sun, 7 Apr 2019 09:00:59 -0400 (EDT) |
User-agent: |
Opera/9.80 (Windows NT 5.0; U; de) Presto/2.6.30 Version/10.63 |
URL:
<https://savannah.nongnu.org/bugs/?56093>
Summary: Wrong constraint in pgmspace.h::pgm_get_far_address
Project: AVR C Runtime Library
Submitted by: gjlayde
Submitted on: Sun 07 Apr 2019 01:00:58 PM UTC
Category: Header
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Header files
Status: None
Percent Complete: 0%
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 2.0.0
Fixed Release: None
_______________________________________________________
Details:
Macro pgm_get_far_address() from avr/pgmspace.h has a wrong constraint for
operand %1: Is must be "ni" (known at compile-time (n) or known ar assembly
time or later (i)) instead of "p".
Moreover, the asm is not volatile, hence the "volatile" can be dropped.
The "tmp" should also be recplaced by an identifier from implementation space
like __tmp.
Last not least, the macro should come with "extension" so that it will work in
strict C mode (and not only with GNU-C which valued blocks are).
Putting everything together, the macro should read
#define pgm_get_far_address(var) \
(__extension__({ \
uint_farptr_t __tmp; \
\
__asm__ ( \
"ldi %A0, lo8(%1)" "\n\t" \
"ldi %B0, hi8(%1)" "\n\t" \
"ldi %C0, hh8(%1)" "\n\t" \
"clr %D0" "\n\t" \
: "=d" (__tmp) \
: "ni" (&(var)) \
); \
__tmp; \
}))
_______________________________________________________
Reply to this item at:
<https://savannah.nongnu.org/bugs/?56093>
_______________________________________________
Message sent via Savannah
https://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-dev] [bug #56093] Wrong constraint in pgmspace.h::pgm_get_far_address,
Georg-Johann Lay <=