This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/49807] Missed byte (subreg) extraction when storing to volatile mem
- From: "gjl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 21 Jul 2011 20:34:15 +0000
- Subject: [Bug rtl-optimization/49807] Missed byte (subreg) extraction when storing to volatile mem
- Auto-submitted: auto-generated
- References: <bug-49807-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49807
--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-21 20:34:14 UTC ---
> (In reply to comment #2)
> That's not quite correct. In avr-libc the header file sfr_defs.h will define a
> register as this:
>
> #define SPDR (*((volatile char *) 0x2c))
(volatile char *) is the same as (char volatile *). Don't confuse it with (char
* volatile) etc.
> Is your intent to change the address AND remove the volatile keyword?
I changed to different addresses in the non-volatile example because otherwise
just the last store will survive.
> Overall, though, I think you're on the right track. Most users would like to be
> able to do the shift-and-assign pattern in C and have it compile to storing the
> individual byte without a shift in the assembly. Right now, the only way to do
> a workaround to achieve that result is through the use of a union with a struct
> and an integer type (like a long). If this issue can be fixed then I think that
> this has a chance to reduce a lot of code size problems.
I don't know the exact rationale why volatile_ok is false in combine.
It' obviously about volatile correctnet, but I don't see what would break here.