https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111519

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #6)
> Created attachment 56089 [details]
> patch
> 
> This patch (against the 13 branch) fixes the bug but it might be a bit
> conservative since some entries (the _addr one for example) may not have
> a live virtual use.  Maybe getting the relevant one from up the call chain
> is better.
> 
> I'm going to throw this at testing but expect some testsuite fallout because
> of this conservativeness.

It causes

FAIL: gcc.dg/Wstringop-overflow-69.c  (test for warnings, line 60)
FAIL: gcc.dg/Wstringop-overflow-69.c  (test for warnings, line 62)

the testcase has

  *(VC4*)a2 = c4;       // { dg-warning "writing 4 bytes into a region of size
2" }
  *(VC4*)a3 = c4;       // { dg-warning "writing 4 bytes into a region of size
3" }
  *(VC8*)a4 = c8;       // { dg-warning "writing 8 bytes into a region of size
4" }
  *(VC8*)a7 = c8;       // { dg-warning "writing 8 bytes into a region of size
7" }

and the later of the two assignments from c4 and c8 fail to be diagnosed
as their load is CSEd to a definition before the earlier of the two
assignments.  Which means the fix is working, not sure if we want to beef
it up with an alias walk, that definitely would require careful looking
as to what random trees we feed into this kitchen-sink routine.

I'm inclined to XFAIL the sub-test, at least on branches, and only maybe
fix it on trunk (well, not myself actually).

Reply via email to