public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113049] New: Compiles to strlen even with -fno-builtin-strlen -fno-optimize-strlen
@ 2023-12-17  9:36 gjl at gcc dot gnu.org
  2023-12-17  9:39 ` [Bug tree-optimization/113049] " gjl at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gjl at gcc dot gnu.org @ 2023-12-17  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113049
           Summary: Compiles to strlen even with -fno-builtin-strlen
                    -fno-optimize-strlen
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

Compile with -S -Os -fno-builtin-strlen -fno-optimize-strlen

typedef __SIZE_TYPE__ size_t;

size_t strlen (const char *text)
{
  size_t len = 0;

  while (*text)
  {
    text++;
    len++;
  }
  return len;

}

Generated code:

strlen:
        b       strlen


Using built-in specs.
COLLECT_GCC=/opt/compiler-explorer/arm/gcc-12.2.0/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc
Target: arm-unknown-linux-gnueabihf
Configured with: /opt/.build/arm-unknown-linux-gnueabihf/src/gcc/configure
--build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu
--target=arm-unknown-linux-gnueabihf
--prefix=/opt/compiler-explorer/arm/gcc-12.2.0/arm-unknown-linux-gnueabihf
--exec_prefix=/opt/compiler-explorer/arm/gcc-12.2.0/arm-unknown-linux-gnueabihf
--with-sysroot=/opt/compiler-explorer/arm/gcc-12.2.0/arm-unknown-linux-gnueabihf/arm-unknown-linux-gnueabihf/sysroot
--enable-languages=c,c++,fortran,d,objc,obj-c++,go --with-arch=armv7-a
--with-fpu=neon --with-float=hard --enable-__cxa_atexit --disable-libmudflap
--enable-libgomp --enable-libssp --enable-libquadmath
--enable-libquadmath-support --enable-libsanitizer --disable-libmpx
--with-gmp=/opt/.build/arm-unknown-linux-gnueabihf/buildtools
--with-mpfr=/opt/.build/arm-unknown-linux-gnueabihf/buildtools
--with-mpc=/opt/.build/arm-unknown-linux-gnueabihf/buildtools
--with-isl=/opt/.build/arm-unknown-linux-gnueabihf/buildtools --enable-lto
--enable-threads=posix --enable-target-optspace --disable-plugin --disable-nls
--enable-tls --disable-multilib
--with-local-prefix=/opt/compiler-explorer/arm/gcc-12.2.0/arm-unknown-linux-gnueabihf/arm-unknown-linux-gnueabihf/sysroot
--enable-long-long --with-mode=thumb
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (GCC) 

https://godbolt.org/z/En3j6Gvda

Maybe this is same / similar to PR102725.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-12-17 17:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-17  9:36 [Bug tree-optimization/113049] New: Compiles to strlen even with -fno-builtin-strlen -fno-optimize-strlen gjl at gcc dot gnu.org
2023-12-17  9:39 ` [Bug tree-optimization/113049] " gjl at gcc dot gnu.org
2023-12-17 10:05 ` mikpelinux at gmail dot com
2023-12-17 14:24 ` gjl at gcc dot gnu.org
2023-12-17 15:10 ` schwab@linux-m68k.org
2023-12-17 15:33 ` gjl at gcc dot gnu.org
2023-12-17 16:47 ` schwab@linux-m68k.org
2023-12-17 17:10 ` gjl at gcc dot gnu.org
2023-12-17 17:28 ` harald at gigawatt dot nl
2023-12-17 17:58 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).