From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E3C123851C01; Thu, 23 Apr 2020 17:17:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E3C123851C01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587662262; bh=NnbJIZwLLLo/wAxCGkih2OW2psiZLia/SzpV4HEBy+I=; h=From:To:Subject:Date:From; b=C0IbLSOy5W1xUS4PDPPd8cRCq5TuebJXi8zBQRsG7N+9X5c5wnmG/MuyBlvM426tQ d9hXVIZ+a3TbSCDvz0WMzx6M+6G5MXlceya5YUmihRZ+aVMQEmxGI5/RGBYkh/TaMY pUfWCq8Gb7Fj3R49XZD8GTg/CHo5Zte9vqj4nCGs= From: "john+gcc at hogberg dot online" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/94734] New: Program crashes when compiled with GCC 10 Date: Thu, 23 Apr 2020 17:17:42 +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.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: john+gcc at hogberg dot online 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 Apr 2020 17:17:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94734 Bug ID: 94734 Summary: Program crashes when compiled with GCC 10 Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: john+gcc at hogberg dot online Target Milestone: --- Created attachment 48361 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D48361&action=3Dedit Test case program The attached program crashes when it has been compiled with GCC 10 and -O2. With -O3 or -Os it returns an incorrect value instead. There are no warnings with `-Wall -Wextra` or `-fanalyzer`, and strangely enough `-fsanitize=3Dundefined` hides the crash without reporting any error= s. -fno-aggressive-loop-optimizations also makes the crash go away which made = me suspect that the code is wrong somehow, but `frama-c` insists that it's cor= rect and should always return 0. If there's a bug in there, I'm not seeing it. :( Steps to reproduce: ---- $ gcc -O2 test.c -o bug $ ./bug Segmentation fault (core dumped) ---- GCC version: ---- $ gcc -v Using built-in specs. COLLECT_GCC=3Dgcc COLLECT_LTO_WRAPPER=3D/usr/local/libexec/gcc/x86_64-pc-linux-gnu/10.0.1/lto= -wrapper Target: x86_64-pc-linux-gnu Configured with: ./configure Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.0.1 20200423 (experimental) (GCC)=20 ---- It appears to work fine with GCC 7, I tested it with: ---- $ gcc-7 -v Using built-in specs. COLLECT_GCC=3Dgcc-7 COLLECT_LTO_WRAPPER=3D/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper OFFLOAD_TARGET_NAMES=3Dnvptx-none OFFLOAD_TARGET_DEFAULT=3D1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion=3D'Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=3Dfile:///usr/share/doc/gcc-7/README.Bu= gs --enable-languages=3Dc,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=3D/u= sr --with-gcc-major-version-only --program-suffix=3D-7 --program-prefix=3Dx86_64-linux-gnu- --enable-shared --enable-linker-build-= id --libexecdir=3D/usr/lib --without-included-gettext --enable-threads=3Dposix --libdir=3D/usr/lib --enable-nls --enable-bootstrap --enable-clocale=3Dgnu --enable-libstdcxx-debug --enable-libstdcxx-time=3Dyes --with-default-libstdcxx-abi=3Dnew --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=3Dauto --enable-multiarch --disable-werror --with-arch-32=3Di686 --with-abi=3Dm64 --with-multilib-list=3Dm32,m64,mx32 --enable-multilib --with-tune=3Dgeneric --enable-offload-targets=3Dnvptx-none --without-cuda-driver --enable-checking=3Drelease --build=3Dx86_64-linux-gnu --host=3Dx86_64-linu= x-gnu --target=3Dx86_64-linux-gnu Thread model: posix gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) ----=