]> gcc.gnu.org Git - gcc.git/commit
ipa/105676 - pure attribute suggestion for const function
authorRichard Biener <rguenther@suse.de>
Wed, 7 Dec 2022 09:26:01 +0000 (10:26 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 17 Apr 2023 09:13:16 +0000 (11:13 +0200)
commit96785885ceed34638d4b58e88cba6e6e8368c0e3
treedea2840e1f516cf3b64eca82b9c28211a4a9bae9
parentde8f86e151d29c6c2ebb224b5587284714cd6cfa
ipa/105676 - pure attribute suggestion for const function

When a function is declared const (even though it technically
accesses memory), ipa-modref discovering pureness shouldn't end
up suggesting that attribute.  The following thus exempts
'const' functions from ipa_make_function_pure handling.

PR ipa/105676
* ipa-pure-const.cc (ipa_make_function_pure): Skip also
for functions already being const.

* gcc.dg/pr105676.c: New testcase.

(cherry picked from commit 45e09c2eb9c2bdd34ef777e06ddc9908dd0664f9)
gcc/ipa-pure-const.cc
gcc/testsuite/gcc.dg/pr105676.c [new file with mode: 0644]
This page took 0.073027 seconds and 6 git commands to generate.