[PATCH][Middle-end]patch for fixing PR 86519

Jeff Law law@redhat.com
Wed Aug 15 04:25:00 GMT 2018


On 08/14/2018 08:57 AM, Qing Zhao wrote:
> Hi,
> 
> PR 86519:New test case gcc.dg/strcmpopt_6.c fails with its introduction in r262636.
> 
> ***the root cause is:
> 
> for the following call to memcmp:   __builtin_memcmp (s->s, "a", 3);
> the specified length 3 is larger than the length of "a", it's clearly an out-of-bound access. This new testing case is try to claim that,
> For such out-of-bound access, we should NOT expand this call at all. The new added in-lining expansion was prohibited under
> such situation, However, the expansion to hardware compare insn (old code) is NOT prohibited under such situation. 
> on powerPC, the above call to memcmp is expanded to hardware compare insn. therefore, the testing case failed.
> 
> ***in addition to the above major issue, there is also one minor issue with the new testing case itself:
> 
> dg-final { scan-rtl-dump-times "__builtin_memcmp" 6 "expand” }
> this is trying to scan the dumped .expand file to match the string “__builtin_memcmp” exactly 6 times. however, the # of times that
> the string “__builtin_memcmp” appears in the .expand file varies on different target or optimization level, in order to avoid such
> instability, instead of scanning the .expand file to match the string “__builtin_memcmp”,  scanning the final assembly file to match
> the string “memcmp”.
> 
> please review the attached simple patch.
> 
> thanks.
> 
> Qing
> 
> gcc/ChangeLog:
> 
> +2018-08-14  Qing Zhao  <qing.zhao@oracle.com>
> +
> +       PR testsuite/86519
> +       * builtins.c (expand_builtin_memcmp): Do not expand the call
> +       when overflow is detected.
> +
> gcc/testsuite/ChangeLog:
> 
> +2018-08-14  Qing Zhao <qing.zhao@oracle.com>
> +
> +       PR testsuite/86519
> +       * gcc.dg/strcmpopt_6.c: Scan the assembly file instead of
> +       the .expand file.
OK.
jeff



More information about the Gcc-patches mailing list