public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108715] New: Infinite loop in the generated assembly with -Os when strlen is defined in the code
@ 2023-02-08 10:29 daniel at eyoman dot com
  2023-02-08 10:30 ` [Bug c/108715] " daniel at eyoman dot com
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: daniel at eyoman dot com @ 2023-02-08 10:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108715
           Summary: Infinite loop in the generated assembly with -Os when
                    strlen is defined in the code
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel at eyoman dot com
  Target Milestone: ---

Created attachment 54426
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54426&action=edit
C file

Hi,

The attached source file is compiled on GCC 12.2.1 with the following command:
gcc -save-temps -Wall -Wextra -Os strlen_bug.c -o strlen_bug

The assembly file, obtained with objdump -d strlen_bug, shows that:
- the for loop dealing with the length calculation has been removed by strlen
- the strlen label jumps to itself
- the program never ends

If the strlen function is removed from the code, the problem doesn't occur.

I wanted to attach the assembly and preprocessed files but I could attach only
one.

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

end of thread, other threads:[~2023-02-08 17:52 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-08 10:29 [Bug c/108715] New: Infinite loop in the generated assembly with -Os when strlen is defined in the code daniel at eyoman dot com
2023-02-08 10:30 ` [Bug c/108715] " daniel at eyoman dot com
2023-02-08 10:30 ` daniel at eyoman dot com
2023-02-08 10:32 ` daniel at eyoman dot com
2023-02-08 10:33 ` daniel at eyoman dot com
2023-02-08 10:34 ` daniel at eyoman dot com
2023-02-08 10:34 ` daniel at eyoman dot com
2023-02-08 10:38 ` daniel at eyoman dot com
2023-02-08 11:27 ` [Bug middle-end/108715] " pinskia at gcc dot gnu.org
2023-02-08 11:34 ` daniel at eyoman dot com
2023-02-08 11:38 ` jakub at gcc dot gnu.org
2023-02-08 12:22 ` daniel at eyoman dot com
2023-02-08 12:37 ` jakub at gcc dot gnu.org
2023-02-08 17:45 ` pinskia at gcc dot gnu.org
2023-02-08 17:48 ` jakub at gcc dot gnu.org
2023-02-08 17:52 ` 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).