This is the mail archive of the gcc@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]

Re: Segment register support for the i386


In article <199912241641.RAA05275@delius.kettenis.local>,
Mark Kettenis  <kettenis@wins.uva.nl> wrote:
>
>Although I have a working example, I lot of work needs to be done to
>assure that the compiler can handle more complex cases correctly, and
>to make sure that the compiler signals invalid use of the segment
>registers correctly.

You might want to try talking to Steve Chamberlain: I know he tried to
do something similar and he may have suggestions (the suggestion may be
"forget it - it's too hairy", but it doesn't hurt to ask). 

I know there were horrible problems with disambiguating pointer
dereferences that looked the same: CSE needs to be _very_ careful.  If
you go ahead with this, would suggest adding a case like this to your
test-suite:

	int test_it(char *ptr)
	{
		char * gs_ptr __attribute("gsseg");

		gs_ptr = ptr;
		return *ptr == *gs_ptr;
	}

If done right, you should see (a) a warning for different types at the
gs_ptr assignment and (b) the compiler must NOT optimize away the
equality test, because while the pointers "look" the same to some degree
from a CSE standpoint, they obviously dereference potentially very
different values. 

I think pointer attributes could be very useful (alignment attributes,
calling convention attributes for function pointers etc), but there are
nasty issues with type checking etc.

		Linus


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