From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 76D973857004; Tue, 29 Dec 2020 01:46:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 76D973857004 From: "yangyibiao at outlook dot com" To: gdb-prs@sourceware.org Subject: [Bug breakpoints/27126] New: Step will skip prior statements for statements with omp atomic directive at -O1 (bug or feature?) Date: Tue, 29 Dec 2020 01:46:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: breakpoints X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: yangyibiao at outlook dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot 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 cc target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2020 01:46:16 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27126 Bug ID: 27126 Summary: Step will skip prior statements for statements with omp atomic directive at -O1 (bug or feature?) Product: gdb Version: HEAD Status: UNCONFIRMED Severity: normal Priority: P2 Component: breakpoints Assignee: unassigned at sourceware dot org Reporter: yangyibiao at outlook dot com CC: vries at gcc dot gnu.org Target Milestone: --- Created attachment 13083 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D13083&action=3Ded= it the binary Consider the following program: --- $ cat small.c int x =3D 6; int main () { // L4 #pragma omp atomic x =3D x * 7 + 6; // L6 #pragma omp atomic x =3D x - 8 + 6; // L8 #pragma omp atomic x =3D x * 7 ^ 6; // L10 return 0; // L11 } --- If compiled with optimization enabled(-O1, -O2, -O3 et.al), gdb behaves incorrect) $ gcc -O1 -g small.c $ gdb a.out (gdb) start Temporary breakpoint 1, main () at small.c:4 4 { // L4 (gdb) s 10 x =3D x * 7 ^ 6; // L10 (gdb) s 11 return 0; // L11 ############################## Line L6 and Line L8 are skipped when stepping. However, LLDB behaves like my expectation: LLDB will stop at L6 and L8. $ gdb -v GNU gdb (GDB) 11.0.50.20201224-git $ gcc -v gcc version 10.2.0 (Ubuntu 10.2.0-5ubuntu1~20.04) --=20 You are receiving this mail because: You are on the CC list for the bug.=