This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR optimization/11210
- From: Ulrich Weigand <weigand at i1 dot informatik dot uni-erlangen dot de>
- To: ebotcazou at libertysurf dot fr
- Cc: wilson at tuliptree dot org, gcc-patches at gcc dot gnu dot org
- Date: Sat, 28 Jun 2003 17:14:11 +0200 (MET DST)
- Subject: Re: [PATCH] Fix PR optimization/11210
Eric Botcazou wrote:
>I got caught by expr.c:get_inner_reference(), which is advertised as handling
>NOP_EXPR and the likes, but doesn't return the value you would have expected
>for NOP_EXPRs wrapping up bitfields. Not sure if this is a bug or a feature,
>but this is certainly not what we want in decode_field_reference(). It's
>amazing that neither IA-32 nor PPC caught the problem.
However, it did cause bootstrap failure on s390x due to miscompilation of
the following snippet from getattrtab.c:
struct attr_desc
{
char *name;
struct attr_desc *next;
unsigned is_numeric : 1;
unsigned negative_ok : 1;
unsigned unsigned_p : 1;
unsigned is_const : 1;
unsigned is_special : 1;
unsigned func_units_p : 1;
unsigned blockage_p : 1;
int lineno;
};
int
test (struct attr_desc *attr)
{
if (! attr->is_special && ! attr->is_const)
write_attr_get (attr);
}
fold_truthop would merge the two struct member accesses into a single
check, but miscompute the necessary mask because it though the members
were 32 bits wide instead of a single bit ...
> * fold-const (decode_field_reference): Record outermost type in
> case the expression is a NOP. Strip all NOPs. Set the signedness
> to that of the outermost type (if any) when the bitsize is equal to the
> size of the type.
This fixes the bootstrap problem on s390x-ibm-linux.
Bye,
Ulrich
--
Dr. Ulrich Weigand
weigand@informatik.uni-erlangen.de