This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with volatile?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]