testsuite: Compile-only gcc.dg/tree-ssa/pr100359.c if ! natural_alignment_32
commit08981d59253ef500a1f6eb19352110562a63d30e
authorHans-Peter Nilsson <hp@axis.com>
Tue, 21 Mar 2023 15:09:23 +0000 (21 16:09 +0100)
committerHans-Peter Nilsson <hp@bitrange.com>
Thu, 23 Mar 2023 20:48:58 +0000 (23 21:48 +0100)
treefca3d0729d885f5fe6b50fda460f4ad1dab537d4
parentf58cbbb7c90d8cfea87dc4490b575a368e1e2c82
testsuite: Compile-only gcc.dg/tree-ssa/pr100359.c if ! natural_alignment_32

The test gcc.dg/tree-ssa/pr100359.c fails the "test for
excess errors" for at least m68k-linux, pru-elf, and
cris-elf according to posts on gcc-testresults.  For
cris-elf, the "excess errors" is a failure to link; an
undefined reference to foo, because the code has a call to
an extern function foo, which is not optimized away, and
which is not defined.  I guess it's the same for those other
targets.

From comparative gdb sessions for native x86_64-linux and
cris-elf, I see tree-ssa-sccvn.cc:vn_reference_lookup_3
(called from the "pre" pass) requires int-size-alignment for
a target to see through the "int *" dereference, that the
expression is constant false and subsequently optimize away
the call to foo.  The conclusion is with substantially less
effort available from comments in PR91419.

The point of the test seems only incidental to
optimizing-out the call to foo, judging from the comments in
PR100359, so an alternative is compile it (not link it) for
all targets.  However, I chose to not change the nature of
the test where it passes.

* gcc.dg/tree-ssa/pr100359.c: Compile-only for ! natural_alignment_32.
gcc/testsuite/gcc.dg/tree-ssa/pr100359.c