Paolo Bonzini writes:
>
> > At a wild guess, maybe strip_useless_type_conversions() is doing
> > something Bad.
>
> Almost there. It looks like strip_useless_type_conversions is not used,
> and then something Bad happens.
>
> The following patch fixes it, but it's completely untested.
>
> 2006-11-07 Paolo Bonzini <[EMAIL PROTECTED]>
>
> * gimplify.c (fold_indirect_ref_rhs): Use
> STRIP_USELESS_TYPE_CONVERSION rather than STRIP_NOPS.
>
> Index: ../../gcc/gimplify.c
> ===================================================================
> --- ../../gcc/gimplify.c (revision 118481)
> +++ ../../gcc/gimplify.c (working copy)
> @@ -3207,7 +3207,7 @@ fold_indirect_ref_rhs (tree t)
> tree sub = t;
> tree subtype;
>
> - STRIP_NOPS (sub);
> + STRIP_USELESS_TYPE_CONVERSION (sub);
> subtype = TREE_TYPE (sub);
> if (!POINTER_TYPE_P (subtype))
> return NULL_TREE;
>
> If anybody could regtest it, this is a regression from 3.3, likely to be
> present in all 4.x branches.
Regtested x86-64-gnu-linux. The only interesting failure was
mayalias-2.c, but that also fails before the patch.
Andrew.
$ /home/aph/gcc/gcc-4_2-branch/x86_64-unknown-linux-gnu/gcc/xgcc
-B/home/aph/gcc/gcc-4_2-branch/x86_64-unknown-linux-gnu/gcc/
/home/aph/gcc/gcc-4_2-branch/gcc/testsuite/gcc.c-torture/execute/mayalias-2.c
-w -O3 -g -fno-show-column -lm -o
/home/aph/gcc/gcc-4_2-branch/x86_64-unknown-linux-gnu/gcc/testsuite/gcc/mayalias-2.x4
/home/aph/gcc/gcc-4_2-branch/gcc/testsuite/gcc.c-torture/execute/mayalias-2.c:2:
internal compiler error: in splice_child_die, at dwarf2out.c:5565
Please submit a full bug report,
with preprocessed source if appropriate.
struct S { short x; };
typedef struct S __attribute__((__may_alias__)) test;
int f() {
int a=10;
test *p=(test *)&a;
p->x = 1;
return a;
}
int main() {
if (f() == 10)
__builtin_abort();
return 0;
}