This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: Prune unused DECL_STMTs from saved tree structure
- To: law at cygnus dot com
- Subject: Re: Patch: Prune unused DECL_STMTs from saved tree structure
- From: Jason Merrill <jason at redhat dot com>
- Date: 29 Aug 2000 10:38:47 -0700
- Cc: Zack Weinberg <zack at wolery dot cumb dot org>, gcc-patches at gcc dot gnu dot org
- References: <6558.967566181@upchuck>
>>>>> Jeffrey A Law <law@cygnus.com> writes:
> In message <20000828101008.V17776@wolery.cumb.org>you write:
>>
>> I started out trying to discard all DECL_STMTs and VAR_DECLS that
>> didn't have their used bit set. However, it turns out that there are
>> several cases where a variable is referenced but TREE_USED(decl) is
>> false. For instance, anything with an initialization expression and
>> no further use; anything with a constructor or destructor (however
>> trivial); and then there were these mysterious unnamed variables
>> introduced by __builtin_va_arg, which is when I gave up trying to
>> account for all the cases.
> We should attack this separately. It sounds rather lame to me that we have
> things which are used, but which don't have TREE_USED set.
The latter case is probably a bug, but the former is by design. We still
want to get -Wunused warnings for objects with constructors that are
declared but never used, so we clear TREE_USED. Perhaps that is a mistake.
Jason