aggregate aliasing losage
Richard Henderson
rth@cygnus.com
Thu Jun 1 12:27:00 GMT 2000
: /* If this is a reference, go inside it and use the underlying
: object. */
: if (TREE_CODE_CLASS (TREE_CODE (t)) == 'r')
: t = get_inner_reference (t, &bitsize, &bitpos, &offset, &mode,
: &unsignedp, &volatilep, &alignment);
I don't see how this is supposed to work.
Consider as a trivial example, g77.f-torture/execute/19981119-0.f.
Here we have `a', which is of type `double [20][20]'. So it's
DECL_RTL is (mem/s:BLK (symbol_ref:DI ("a.0")) 26). That's fine.
Later, when we're expanding an array reference, around line 6892
of expand_expr we call set_mem_attributes (op0, exp, 0) like you'd
expect. That's also fine.
What's not fine is that the passage quoted above decides that
<array_ref 0x20000068b00
type <real_type 0x20000034300 double precision DF
size <integer_cst 0x20000029b00 constant 64>
unit size <integer_cst 0x20000029b40 constant 8>
align 64 symtab 0 alias set 13 precision 64
pointer_to_this <pointer_type 0x2000004e500>>
arg 0 <array_ref 0x20000068a40
type <array_type 0x2000004f100
type <real_type 0x20000034300 double precision>
BLK
size <integer_cst 0x20000056b80 constant 1344>
unit size <integer_cst 0x20000056bc0 constant 168>
align 64 symtab 0 alias set -1 domain <integer_type 0x2000004f000>
pointer_to_this <pointer_type 0x2000004f300>>
arg 0 <var_decl 0x2000004f500 a type <array_type 0x2000004f400>
...>>>
should use the alias set for `a' and not for `double'. Which
is clearly wrong, IMO.
In the test case, the type node for `u' (the parameter in the subroutine)
and the type node for `a' (the variable in the main program) are
different. This is not unreasonable I don't think, especially since
there's no necessary correspondence of array shape between caller and
callee in Fortran.
But it does mean that the store from the inlined subroutine and the
load in the main program acquire different alias sets, which of course
leads to the test case being mis-scheduled.
r~
More information about the Gcc-bugs
mailing list