]> gcc.gnu.org Git - gcc.git/commit
Fix &MEM_REF fold in expand_simple_operations
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 20 Apr 2022 15:42:22 +0000 (16:42 +0100)
committerMatthew Malcomson <matthew.malcomson@arm.com>
Thu, 5 May 2022 11:57:52 +0000 (12:57 +0100)
commit978d3670e25b488ac577ee439a8aba783cee3f41
tree086badc4d9af03b5654f41b049b8a6358f7b689b
parenta4a587c96ec5b85fbd90793d7a2d8b4e65d9745d
Fix &MEM_REF fold in expand_simple_operations

expand_simple_operations looks for expressions of the form

  &MEM_REF(ptr)compoment-refs

where component-refs include things like field names and array
indices.  It then folds that to:

  POINTER_PLUS_EXPR<ptr, offset>

where offset is the byte offset associated with component-refs.

In the testcase, the function was doing that even when ptr was a
capability and the result of the & wasn't, meaning that the type
on the POINTER_PLUS_EXPR dropped the capability from the result.

Fortunately this was caught by verify_gimple, as intended,
so it wasn't a silent error.
gcc/testsuite/gcc.target/aarch64/morello/pointer-arith-4.c [new file with mode: 0644]
gcc/tree-ssa-loop-niter.c
This page took 0.071215 seconds and 6 git commands to generate.