https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63483
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #8)
> How can I reproduce this? Even with -mcpu=ev4 I get
>
> $foo..ng:
> foo:
> .frame $30,0,$26,0
> $LFB0:
> .cfi_startproc
> .prologue 0
> mov $31,$2
> ldq_u $1,1($2)
> zapnot $1,253,$1
> stq_u $1,1($2)
> call_pal 0x81
>
> I configured with --target=alphaev68-linux-gnu
>
> And used -O2 -mcpu=ev4 (sounds "earliest").
>
> Note that the pointers 'a' and 'b' are likely made constant by IPA reference
> and thus loads of the pointers can validly get /u, but not loads from the
> pointers (well, we may even figure out their value is always zero...).
Indeed. From my .optimized dump:
foo ()
{
<bb 2>:
MEM[(char *)0B + 1B] ={v} 0;
__builtin_trap ();
> Does it "fix" the testcase if you have a function writing to a and b or
> making a and b not static?
Then I get
$foo..ng:
.prologue 1
ldq $1,a($29) !literal
ldq $2,0($1)
lda $1,1($31)
cpys $f31,$f31,$f31
lda $4,1($2)
ldq_u $3,1($2)
insbl $1,$4,$1
mskbl $3,$4,$3
bis $1,$3,$1
stq_u $1,1($2)
lda $2,1($31)
ldq $1,b($29) !literal
ldq $1,0($1)
stl $2,8($1)
ret $31,($26),1
not sure if that's correct. Adjusted testcase:
char *a;
int *b;
void foo (void)
{
a[1] = 1;
b[2] = 1;
}
int bar (void)
{
return a && b;
}