https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625

nsz at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nsz at gcc dot gnu.org

--- Comment #2 from nsz at gcc dot gnu.org ---
int hallo ();
int dummy ()
{
  char array[] = "abc";
  hallo ();
  return __builtin_strlen (array);
}

if strlen is pure then it cannot be evaluated at compile time because hallo
might modify global state, but strlen should be modeled with attribute const,
since the result cannot depend on global state.

i.e. in gcc/builtins.def

DEF_LIB_BUILTIN_CHKP   (BUILT_IN_STRLEN, "strlen", BT_FN_SIZE_CONST_STRING,
ATTR_PURE_NOTHROW_NONNULL_LEAF)

the PURE should be CONST.

Reply via email to