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] |
| Other format: | [Raw text] | |
Dale Johannesen <dalej@apple.com> writes:
On Jan 29, 2004, at 3:12 AM, Andreas Schwab wrote:This has the same problem.
{ \ *(void **) __o->next_free = (void *) datum; \ __o->next_free += sizeof (void *); \ } \
True, cut and paste error. But it still has the problems I mentioned before.
Which problems do you mean?
can happen. I believe the following is correct, performance neutral,
and
standard-conforming:
{ \ void ***t = (void ***)&(__o->next_free); \ **t = ((void *)datum); \ (*t)++; \ } \
I think this will break strict aliasing.
So does the other way; *(void **)__o->next_free = ... is exactly what you
can't do.
I don't follow. __o->next_free is a character pointer, thus can alias all
other pointers.
The problem with your version is, IIUC, that it converts a (char **) into a (void ***), which cannot alias under the strict aliasing rules, and the compiler can assume that (*t)++ does not modify __o->next_free.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |