-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/20/11 13:06, Xinliang David Li wrote:
> On Wed, Apr 20, 2011 at 12:03 PM, Cary Coutant <ccout...@google.com> wrote:
>>> This brings out 2 questions.  Why don't GCC 4.4/4.6/4.7 warn it?
>>> Why doesn't 64bit GCC 4.2 warn it?
>>
>> Good question. It seems that the difference is whether the compiler
>> generates a field-by-field copy or a call to memcpy(). According to
>> David, the trunk gcc in 32-bit mode doesn't call memcpy, but still
>> doesn't warn. He's looking at it.
> 
> It seems to be related to alias rewrite -- the use of single memory
> token somehow blocks the warning (even though the struct read are
> SRAed).
You can end up tripping over all kinds of things.  In fact, I found
myself today looking at this for -Warray-bounds:


  # BLOCK 11 freq:4946
  # PRED: 9 [50.0%]  (false,exec) 10 [100.0%]  (fallthru,exec) 8 [28.0%]
 (false,exec)
Invalid sum of incoming frequencies 2819, should be 4946
  # D.39048_1 = PHI <3(9), D.39048_19(10), 4294967295(8)>
  # VUSE <.MEM_38(D)>
  D.39016_24 = default_target_hard_regs.x_fixed_regs[D.39048_1];

Note the value of D.39041_1 if we enter through block #8.  We get no
warning.   Now one of my local patches happens to isolate the path which
includes the edge 8->11 creating this block:


  # BLOCK 18
  # PRED: 8 [28.0%]  (false,exec)
Invalid sum of incoming frequencies 692, should be 0
  # VUSE <.MEM_39(D)>
  D.38986_52 = default_target_hard_regs.x_fixed_regs[4294967295];


Which (of course) triggers the -Warray-bounds warning.  Whee fun,
optimize better and expose a warning.  As it turns out the path
including 8->11 is unexecutable, but to expose that we're really going
to have to tackle path isolation in a real way rather than the ad-hoc
stuff done by the jump threader right now.





Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNr2X8AAoJEBRtltQi2kC7Bo8H/0Le7ZdG8Fi/XMRPqbc3oiF/
A8zipmNXNdw29JTH488GJR4BtAuhidiw1EmdUBgj4UxhNXVvHkF+zJBEnzh/6oS5
exY9qTU0/hY6eW4UsdefQPczu1Uy/CSJgs9jFzZjLku6ao6EudOdiE5xXS6xc4Iq
K2epQkMLFigc05W7TNGWNFC+r6Ty6OlS1xz8IIUOunjBwTax4QWQknAy5YDvXiF+
yJCTvattorNxgCEYizG+sVCo0/wNtZB0s2V/TDCdOWeOsZI2/yWC8+QKGcacnZRQ
L2vGQkq7fHScNxsLrxSGbnCj72W9StM/eSYU9ABfMl4KLcq2miuy7JXEz3qDlok=
=LO3d
-----END PGP SIGNATURE-----

Reply via email to