From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DDE8C3858D39; Wed, 8 Feb 2023 10:29:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDE8C3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675852173; bh=leO/wxIsu/O3ChhC872s0anaapmJ+JRb2x/7J7TSI74=; h=From:To:Subject:Date:From; b=HLDmuka+M361n1OeIJVRDjAD2AhmT1NJ95iu3Qw2G7dSsRvL6pnGJdYUAHSI3Pn++ fHWVLwg5pAG118Lagd84uE4mF7vDs9a+7JT0XHczfu7hxEEyG7xQkX8cWqtUtN2S+6 6/2q3lDWd/x4tlJ4ImSaO/UqKVLJgydlfXTYWqS0= From: "daniel at eyoman dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/108715] New: Infinite loop in the generated assembly with -Os when strlen is defined in the code Date: Wed, 08 Feb 2023 10:29:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: daniel at eyoman dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108715 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=3D54426&action=3Dedit C file Hi, The attached source file is compiled on GCC 12.2.1 with the following comma= nd: 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 strl= en - 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 o= nly one.=