[Bug tree-optimization/113049] Compiles to strlen even with -fno-builtin-strlen -fno-optimize-strlen

2023-12-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113049

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #9 from Andrew Pinski  ---
dup

*** This bug has been marked as a duplicate of bug 102725 ***

[Bug tree-optimization/113049] Compiles to strlen even with -fno-builtin-strlen -fno-optimize-strlen

2023-12-17 Thread harald at gigawatt dot nl via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113049

Harald van Dijk  changed:

   What|Removed |Added

 CC||harald at gigawatt dot nl

--- Comment #8 from Harald van Dijk  ---
(In reply to Georg-Johann Lay from comment #5)
> So then -fno-builtin should also not work? GCC documentation of -fno-builtin
> is the same like for -fno-builtin-function.

-fno-builtin implies -fno-tree-loop-distribute-patterns
(https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=b15458becf4086c463cba0c42db1d8780351201b),
-fno-builtin-strlen does not, but I think you are right that that does not
match the documentation.

(In reply to Georg-Johann Lay from comment #7)
> The documentation of -ftree-loop-distribute-patterns does not relate in any
> way to that.  It's impossible to find this option from a problem description.

-ffreestanding also implies -fno-tree-loop-distribute-patterns, and that option
is documented in a way that would help here. Unless -ffreestanding is used, GCC
assumes the presence of a conforming standard library. It may expand calls to
library functions based on knowledge of what these functions do, and it may
replace code by calls to library functions as well for the same reason.

-fno-builtin and -fno-builtin-(function) are both documented as stopping the
former, but not documented as stopping the latter. The fact that one does, but
not both, is surprising.

[Bug tree-optimization/113049] Compiles to strlen even with -fno-builtin-strlen -fno-optimize-strlen

2023-12-17 Thread gjl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113049

--- Comment #7 from Georg-Johann Lay  ---
(In reply to Andreas Schwab from comment #6)
> That's what -fno-tree-loop-distribute-patterns is for.

So you know the GCC sources and can draw that conclusion.

The documentation of -ftree-loop-distribute-patterns does not relate in any way
to that.  It's impossible to find this option from a problem description.

[Bug tree-optimization/113049] Compiles to strlen even with -fno-builtin-strlen -fno-optimize-strlen

2023-12-17 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113049

--- Comment #6 from Andreas Schwab  ---
That's what -fno-tree-loop-distribute-patterns is for.

[Bug tree-optimization/113049] Compiles to strlen even with -fno-builtin-strlen -fno-optimize-strlen

2023-12-17 Thread gjl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113049

--- Comment #5 from Georg-Johann Lay  ---
(In reply to Andreas Schwab from comment #4)
> -fno-builtin-strlen has a different purpose.

So then -fno-builtin should also not work? GCC documentation of -fno-builtin is
the same like for -fno-builtin-function.

At least there should be an option to disable this, e.g. you need it when
building libgcc / libc anyway, you you get silly non-functional libs.

[Bug tree-optimization/113049] Compiles to strlen even with -fno-builtin-strlen -fno-optimize-strlen

2023-12-17 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113049

--- Comment #4 from Andreas Schwab  ---
-fno-builtin-strlen has a different purpose.

[Bug tree-optimization/113049] Compiles to strlen even with -fno-builtin-strlen -fno-optimize-strlen

2023-12-17 Thread gjl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113049

--- Comment #3 from Georg-Johann Lay  ---
(In reply to Mikael Pettersson from comment #2)
> Does -fno-tree-loop-distribute-patterns work? That's been the go-to for
> disabling similar loop-to-call transformations people have been objecting to.

It works. But even if it does, that's not intuitive, and -fno-builtin-strlen
should work no matter what.

And also, when a function's assembly name is "funcxyz", then the compiler
should never issue a concocted call to "funcxyz", because the assumptions of
the compiler of what "funcxyz" is doing is obviously wrong.

[Bug tree-optimization/113049] Compiles to strlen even with -fno-builtin-strlen -fno-optimize-strlen

2023-12-17 Thread mikpelinux at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113049

--- Comment #2 from Mikael Pettersson  ---
Does -fno-tree-loop-distribute-patterns work? That's been the go-to for
disabling similar loop-to-call transformations people have been objecting to.

[Bug tree-optimization/113049] Compiles to strlen even with -fno-builtin-strlen -fno-optimize-strlen

2023-12-17 Thread gjl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113049

--- Comment #1 from Georg-Johann Lay  ---
-fno-builtin works, but that seems too much. -fno-builtin-strlen should switch
it off IMO.