Problem with volatile?

Hughes Kevin Kevin.Hughes@icl.com
Tue Jun 5 08:35:00 GMT 2001


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



More information about the Gcc-bugs mailing list