https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125487
Drea Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot
gnu.org
--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
This fixes the issue, I think. The problem is this builtin is a front-end one
and fold not checking to make sure it was normal builtin when it is called:
```
diff --git a/gcc/builtins.cc b/gcc/builtins.cc
index 05d5fb13bfc..b860f425c37 100644
--- a/gcc/builtins.cc
+++ b/gcc/builtins.cc
@@ -11086,7 +11086,7 @@ fold_call_expr (location_t loc, tree exp, bool ignore)
if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
return targetm.fold_builtin (fndecl, call_expr_nargs (exp),
CALL_EXPR_ARGP (exp), ignore);
- else
+ else if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_NORMAL)
{
tree *args = CALL_EXPR_ARGP (exp);
ret = fold_builtin_n (loc, exp, fndecl, args, nargs, ignore);
```
If I get some time I will test this change.