This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Problem with volatile?
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Problem with volatile?
- From: Hughes Kevin <Kevin dot Hughes at icl dot com>
- Date: Tue, 5 Jun 2001 16:40:40 +0100
Running 2.95.3 under cygwin I get a problem with the following code:
struct SID
{
int i;
int j;
};
static volatile SID *fred;
void test(SID *bill)
{
*fred=*bill;
}
The compiler outputs the following message:
bash.exe-2.05$ g++ f.c -c -of.o
f.c: In function `void test(SID *)':
f.c:13: passing `volatile SID' as `this' argument of `struct SID &
SID::operator =(const SID &)' discards qualifiers
If I replace the struct SIF by int:
static volatile int *fred;
void test(int *bill)
{
*fred=*bill;
}
it compiles clean
I want the pointer fred to point to a volatile area which I can then read
and write.
Any ideas what I am doing wrong?
Thanks in advance
Kevin