https://gcc.gnu.org/g:bfedd20faaab8ee827db47c1b2e3f879fd8ba808
commit r17-4515-gbfedd20faaab8ee827db47c1b2e3f879fd8ba808 Author: Josef Melcr <[email protected]> Date: Thu Sep 10 15:49:31 2026 +0200 Downgrade IFN_ASSUME from const to pure This patch changes IFN_ASSUME to be pure instead of const. The const attribute means (not only) that the function cannot read global memory. While this is true for the internal call itself, it is only a dispatcher for the outlined assume body, which may read any memory, e.g. below: ``` struct S { int x, y; }; bool bar (int, int); bool foo (struct S *s) { [[assume (bar (s->x, s->y))]]; return s->x; } ``` Now, the read does not actually happen in reality, as the assume's body does not make into the final binary, but the call being marked incorrectly as const makes our analysis less accurate. PR ipa/127104 gcc/ChangeLog: * internal-fn.def (ASSUME): Downgrade from const to pure. Signed-off-by: Josef Melcr <[email protected]> Diff: --- gcc/internal-fn.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def index af9f92950c73..b1c46a82a520 100644 --- a/gcc/internal-fn.def +++ b/gcc/internal-fn.def @@ -633,7 +633,7 @@ DEF_INTERNAL_FN (SHUFFLEVECTOR, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) DEF_INTERNAL_FN (SPACESHIP, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL) /* [[assume (cond)]]. */ -DEF_INTERNAL_FN (ASSUME, ECF_CONST | ECF_LEAF | ECF_NOTHROW +DEF_INTERNAL_FN (ASSUME, ECF_PURE | ECF_LEAF | ECF_NOTHROW | ECF_LOOPING_CONST_OR_PURE, NULL) /* For if-conversion of inbranch SIMD clones. */
