This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Another case of DCE deleting live code
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: dnovillo at redhat dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 10 Nov 04 09:39:49 EST
- Subject: Re: Another case of DCE deleting live code
Yes, please, and as for test cases, what's wrong with the one you
provided originally?
(1) Once the front end is fixed, that case won't need the alias set zero.
(2) It also needs a change in gimplification.
I found the directory with the test case files, but it's a bit of a
mess: 13 files of 123 lines total. I have to sort out a simple case.
First, let me see if I understood the problem. We have a pointer P of
type 'TYPE *' and for some reason we know that P can actually point to
variables of any arbitrary type in the program. That is, 'TYPE *'
behaves like 'char *' in C?
Sort of.
If that is the case, then we already have a mechanism for dealing with
that. TYPE should be assigned alias set 0.
Except that it's not "TYPE" that's special, but "TYPE *". So it's some sort
of a variant and we do have to emit conversions between them. See my
last message (yes, I know I don't thread yet: that's on MY list, but I
want to get these last bugs fixed before doing that work).
The macro TYPE_REF_CAN_ALIAS_ALL should not be necessary, at all.
Having two mechanisms for describing the same property will only give
us trouble.
I'm beginning to agree, though it's not quite the same property! When I
implemented this (which was before the lang-hook concept), alias.c looked
for "char *", not "char" for the setting of alias set zero. So that's
the code I copied. It has indeed now changed.
But there's still a fundamental difference: in the C case, it's *all* pointers
to a character type. In the Ada case, it has nothing to do with the type
being pointed to, but instead is an attribute given to the pointer (either
explicitly by the programmer with a pragma No_Strict_Aliasing or
implicitly if the type is defined in the same compilation unit as an
unchecked conversion for which it is the destination).
I see that my idea of using a real variant won't work because alias.c
look at TYPE_MAIN_VARIANT. But copying the type is a very non-trivial task
if it's a record since those fields point back at the type. So I think we'd
need to modify alias.c to not look a TYPE_MAIN_VARIANT if the alias set
is already set.
The bottom line for me is that I don't quite see this as reusing an existing
mechanism, but making a different new one. However, I think it's quite
appropriate to make this change because we did change from handling char *
to handling char and this is a analog of that.