https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70848
prathamesh3492 at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |prathamesh3492 at gcc dot
gnu.org
--- Comment #11 from prathamesh3492 at gcc dot gnu.org ---
(In reply to ktkachov from comment #10)
> (In reply to Richard Biener from comment #8)
> > With an old cross to arm I can indeed see (.018t.ssa):
> >
> > void test() ()
> > {
> > volatile int * _1;
> > volatile int * _4;
> > volatile int * _6;
> >
> > <bb 2>:
> > _1 = 327221280B;
> > *_1 = 97;
> > _4 = 327221280B;
> > *_4 = 98;
> > _6 = 327221280B;
> > *_6 = 99;
> > return;
> >
> >
> > note the missing {v} at the assignments.
>
> I wonder why this doesn't happen on x86 or aarch64...
> Is there some target hook called that erroneously strips the 'volatility'
> from the type somewhere?
Hi,
I could reproduce the issue on x86_64 with g++ as of r235554.
Dump of 018t.ssa compiled with g++ -O2:
(also same for aarch64)
;; Function void test() (_Z4testv, funcdef_no=0, decl_uid=2253, cgraph_uid=0,
symbol_order=1)
void test() ()
{
volatile int * p.0_2;
volatile int * p.0_4;
volatile int * p.0_6;
<bb 2>:
p.0_2 = p;
*p.0_2 = 97;
p.0_4 = p;
*p.0_4 = 98;
p.0_6 = p;
*p.0_6 = 99;
return;
}
and generated asm for test:
_Z4testv:
.LFB0:
.cfi_startproc
movq p(%rip), %rax
movl $99, (%rax)
ret
.cfi_endproc
which I suppose is wrong since it avoids stores of 97 and 98 to *p.
With C FE, the ssa dump is as follows:
;; Function test (test, funcdef_no=0, decl_uid=1756, cgraph_uid=0,
symbol_order=1)
test ()
{
volatile int * p.0_2;
volatile int * p.0_4;
volatile int * p.0_6;
<bb 2>:
p.0_2 = p;
*p.0_2 ={v} 97;
p.0_4 = p;
*p.0_4 ={v} 98;
p.0_6 = p;
*p.0_6 ={v} 99;
return;
}
generated asm with C FE:
test:
.LFB0:
.cfi_startproc
movq p(%rip), %rax
movl $97, (%rax)
movl $98, (%rax)
movl $99, (%rax)
ret
.cfi_endproc
So it perhaps appears to be a C++FE issue with gimplification ?
Thanks,
Prathamesh