[Bug ipa/115237] -Wsuggest-attribute=pure false positive for obviously non-pure function
eggert at cs dot ucla.edu
gcc-bugzilla@gcc.gnu.org
Tue Jan 20 08:54:34 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115237
--- Comment #6 from Paul Eggert <eggert at cs dot ucla.edu> ---
(In reply to rguenther@suse.de from comment #5)
> The analysis could be more precise and track 'noreturn' calls
> separately from loops not known to terminate and suppress the
> diagnostic in case of presence of the former. So I'll take it
> as enhancement request for this.
Thanks, that would fix the problem reported here.
PS. As mentioned in bug#109914, because of ISO C23 § 6.8.6.1 ¶ 4, GCC need not
worry about a loop not known to terminate, if the loop's controlling expression
is not a constant expression and its body does not do I/O or access volatile
storage or do synchronization or atomic operations. This could also help
suppress unwanted diagnostics.
More information about the Gcc-bugs
mailing list