[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC, PATCH] shrink struct vectorlike_header #2
From: |
Stefan Monnier |
Subject: |
Re: [RFC, PATCH] shrink struct vectorlike_header #2 |
Date: |
Thu, 08 Nov 2012 09:03:13 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
>> I doubt (*(struct Lisp_Vector **)((char *) v + header_size))
>> is any better. I guess it just defeats gcc's detection of the problem.
> Casting through char * is better, because the C standard
> says that a compiler cannot do type-based alias inferencing
> in the presence of char * pointers.
That's so backwards: rather than force people to use low-level fiddly
code, why can't they say "oh wait, you're doing some funny cast, let's
be more conservative with type-based aliasing, as if the code used
char*".
> I presume this is why GCC generates all those warnings when we don't
> use char * -- GCC is warning us that it may be doing optimizations
> that will crash our code.
IOW it's telling us "beware that even though I have here evidence that
type-based alias analysis is unsafe for your code, I'll go ahead and use
it anyway even though I know how not to use it since I have to do that
when you use char* casts!". Nice.
> struct Lisp_Vector
> {
> struct vectorlike_header header;
> union
> {
> Lisp_Object contents[1];
> struct Lisp_Vector *next;
> } u;
> };
Yes, that'd be better.
Stefan
- [RFC, PATCH] shrink struct vectorlike_header #2, Dmitry Antipov, 2012/11/06
- Re: [RFC, PATCH] shrink struct vectorlike_header #2, Stefan Monnier, 2012/11/06
- Re: [RFC, PATCH] shrink struct vectorlike_header #2, Dmitry Antipov, 2012/11/07
- Re: [RFC, PATCH] shrink struct vectorlike_header #2, Stefan Monnier, 2012/11/07
- Re: [RFC, PATCH] shrink struct vectorlike_header #2, Paul Eggert, 2012/11/08
- Re: [RFC, PATCH] shrink struct vectorlike_header #2, Dmitry Antipov, 2012/11/08
- Re: [RFC, PATCH] shrink struct vectorlike_header #2,
Stefan Monnier <=
- Re: [RFC, PATCH] shrink struct vectorlike_header #2, Dmitry Antipov, 2012/11/08
- Re: [RFC, PATCH] shrink struct vectorlike_header #2, Dmitry Antipov, 2012/11/08
- Re: [RFC, PATCH] shrink struct vectorlike_header #2, Paul Eggert, 2012/11/08
- Re: [RFC, PATCH] shrink struct vectorlike_header #2, Andreas Schwab, 2012/11/08
- Re: [RFC, PATCH] shrink struct vectorlike_header #2, Nix, 2012/11/08
- Re: [RFC, PATCH] shrink struct vectorlike_header #2, Andreas Rottmann, 2012/11/09
- Re: [RFC, PATCH] shrink struct vectorlike_header #2, Stephen J. Turnbull, 2012/11/08
Re: [RFC, PATCH] shrink struct vectorlike_header #2, Paul Eggert, 2012/11/06