From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 03A57385416F; Thu, 23 Jun 2022 19:36:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 03A57385416F From: "dflogeras2 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/106068] New: Infinite loop generated with -mcpu=cortex-m7 and -O2 Date: Thu, 23 Jun 2022 19:36:49 +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: 10.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dflogeras2 at gmail 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2022 19:36:50 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106068 Bug ID: 106068 Summary: Infinite loop generated with -mcpu=3Dcortex-m7 and -O2 Product: gcc Version: 10.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dflogeras2 at gmail dot com Target Milestone: --- Created attachment 53197 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53197&action=3Dedit Preprocessed src to reproduce bug We hit this suspected bug compiling an older firmware after recently upgrad= ing to a more recent version of GCC. It can be triggered by 11.3.0, while the = old 5.4.x version did not produce the infinite loop. The code snippet is from a quite old version of LWIP (stripped down to the minimal). It appears to not be exiting the loop on the second condition (n= <2). The exact command I used to generate the .i is as follows: arm-none-eabi-gcc -mcpu=3Dcortex-m7 src/core/dhcp.c -c -save-temps -g -O2 GCC that it definitely fails on is as follows: arm-none-eabi-gcc -v Using built-in specs. COLLECT_GCC=3Darm-none-eabi-gcc COLLECT_LTO_WRAPPER=3D/usr/libexec/gcc/arm-none-eabi/11.3.0/lto-wrapper Target: arm-none-eabi Configured with: /var/tmp/notmpfs/portage/cross-arm-none-eabi/gcc-11.3.0/work/gcc-11.3.0/con= figure --host=3Dx86_64-pc-linux-gnu --target=3Darm-none-eabi --build=3Dx86_64-pc-l= inux-gnu --prefix=3D/usr --bindir=3D/usr/x86_64-pc-linux-gnu/arm-none-eabi/gcc-bin/1= 1.3.0 --includedir=3D/usr/lib/gcc/arm-none-eabi/11.3.0/include --datadir=3D/usr/share/gcc-data/arm-none-eabi/11.3.0 --mandir=3D/usr/share/gcc-data/arm-none-eabi/11.3.0/man --infodir=3D/usr/share/gcc-data/arm-none-eabi/11.3.0/info --with-gxx-include-dir=3D/usr/lib/gcc/arm-none-eabi/11.3.0/include/g++-v11 --with-python-dir=3D/share/gcc-data/arm-none-eabi/11.3.0/python --enable-languages=3Dc,c++ --enable-obsolete --enable-secureplt --disable-w= error --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=3Drelease --with-bugurl=3Dhttps://bugs.gentoo.org/ --with-pkgversion=3D'Gentoo 11.3.0= p4' --disable-esp --enable-libstdcxx-time --disable-libstdcxx-pch --enable-poison-system-directories --disable-libstdcxx-time --with-sysroot=3D/usr/arm-none-eabi --disable-bootstrap --with-newlib --enable-multilib --disable-fixed-point --disable-libgomp --disable-libssp --disable-libada --disable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --without-zstd --enable-lto --without-isl --disable-libsanitizer --disable-default-pie --enable-default-ssp --with-multilib-list=3Drmprofile Thread model: single Supported LTO compression algorithms: zlib gcc version 11.3.0 (Gentoo 11.3.0 p4)=