aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorQing Zhao <qing.zhao@oracle.com>2025-07-09 20:10:30 +0000
committerQing Zhao <qing.zhao@oracle.com>2025-07-10 20:31:17 +0000
commit1cf8d08a977f528c6e81601b7586ccf8bc8aa2a6 (patch)
tree643ce825dfcef71943b10f045a082f7fd9f6e29a /libgcc
parentca034694757f0fb3461a1d0c22708a3e4c0e40fa (diff)
downloadgcc-1cf8d08a977f528c6e81601b7586ccf8bc8aa2a6.zip
gcc-1cf8d08a977f528c6e81601b7586ccf8bc8aa2a6.tar.gz
gcc-1cf8d08a977f528c6e81601b7586ccf8bc8aa2a6.tar.bz2
Passing TYPE_SIZE_UNIT of the element as the 6th argument to .ACCESS_WITH_SIZE (PR121000)
The size of the element of the FAM _cannot_ reliably depends on the original TYPE of the FAM that we passed as the 6th parameter to the .ACCESS_WITH_SIZE: TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (gimple_call_arg (call, 5)))) when the element of the FAM has a variable length type. Since the variable that represents TYPE_SIZE_UNIT has no explicit usage in the original IL, compiler transformations (such as DSE) that are applied before object_size phase might eliminate the whole definition to the variable that represents the TYPE_SIZE_UNIT of the element of the FAM. In order to resolve this issue, instead of passing the original TYPE of the FAM as the 6th argument to .ACCESS_WITH_SIZE, we should explicitly pass the original TYPE_SIZE_UNIT of the element TYPE of the FAM as the 6th argument to the call to .ACCESS_WITH_SIZE. PR middle-end/121000 gcc/c/ChangeLog: * c-typeck.cc (build_access_with_size_for_counted_by): Update comments. Pass TYPE_SIZE_UNIT of the element as the 6th argument. gcc/ChangeLog: * internal-fn.cc (expand_ACCESS_WITH_SIZE): Update comments. * internal-fn.def (ACCESS_WITH_SIZE): Update comments. * tree-object-size.cc (access_with_size_object_size): Update comments. Get the element_size from the 6th argument directly. gcc/testsuite/ChangeLog: * gcc.dg/flex-array-counted-by-pr121000.c: New test.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions