[committed] adjust ipa-sra tests to avoid using array parameters

Martin Sebor msebor@gmail.com
Mon Sep 21 21:01:38 GMT 2020


The SRA pass relies on the absence of function type attributes
to enable optimization like unused argument elision.  The intent
appears to be to avoid messing with the positions of arguments
that may be relied on by some type attributes.

The recent enhancement to detect out-of-bounds accesses by array
(including VLA) function arguments relies on the C front end
implicitly adding attribute access to the types if functions that
take such arguments.  This in turn interferes with a few SRA tests
that make use of the array notation in the declaration of the argv
array in main().

Since the use of the array notation is incidental to the purpose
of the SRA tests, to clean up the failures in r11-3333 I have
committed the attached patch  to avoid incidental failures due
to implicit attribute access.

In case it's important to preserve the SRA optimization in the case
of array arguments that don't depend on their positions in the argument
list (only a subset of VLAs do so it seems like it would be nice to
keep it for the rest) I'm testing a followup enhancement to let SRA
recognize the new access attribute and let the optimization take
effect even its presence.  I'll post this patch once I'm done
testing it.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-sra-tests.diff
Type: text/x-patch
Size: 2268 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200921/bfaa291f/attachment.bin>


More information about the Gcc-patches mailing list