From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ACDB93858D37; Thu, 7 Sep 2023 08:09:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACDB93858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694074191; bh=0Q0DCBWG2xuRfAIK3SXnTu/z5fuHq27RNp5PHY1jAYI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jyie7SYUIO1gWsPV5xlt+NzBpmavTNROIecNkfrSmlpSYTZ2YoFezFiyTetmSGnMr O3f92QJZqGgjBV32znnc34WcheLwPdXi1u1grLfKdX4VfBA7GCNnHe6PsIwQUl9gLB JXNYnOVBC4qHrSGz68BYhq/DX03lFLx9cRmaEgF4= From: "shaohua.li at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/111319] Wrong code at -O2 on x86_64-linux-gnu Date: Thu, 07 Sep 2023 08:09:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: shaohua.li at inf dot ethz.ch X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: Message-ID: In-Reply-To: References: 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=3D111319 --- Comment #4 from Shaohua Li --- (In reply to Xi Ruoyao from comment #3) > Please try not to create more reports with "not sure if there is UB" esp. > this UB should be obvious, and it's also detectable with > -fsanitize=3Dundefined: >=20 > t.c:13:7: runtime error: load of address 0x7ffd53183020 with insufficient > space for an object of type 'int' > 0x7ffd53183020: note: pointer points here > 2a 56 00 00 01 00 00 00 00 00 00 00 00 14 1a ed ca 50 d4 0e 00 00 00 = 00 > 00 00 00 00 98 31 18 53 > ^ UBSan only detects it at -O2 level and I used `-O0 -fsanitize=3Daddress,undefined` to detect if there is any report. https://godbolt.org/z/zvcG8znvT=