From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 10D283857810; Tue, 6 Apr 2021 15:48:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10D283857810 From: "izbyshev at ispras dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/99903] 32-bit x86 frontends randomly crash while reporting timing on Windows Date: Tue, 06 Apr 2021 15:48:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: izbyshev at ispras dot ru X-Bugzilla-Status: WAITING 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: 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 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: Tue, 06 Apr 2021 15:48:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99903 --- Comment #3 from Alexey Izbyshev --- Crashes eventually occurred with both one- and two-processor affinity masks= , so pinning GCC to a single core doesn't help. But I've tracked the reason down. When `get_time()` from `gcc/timevar.c` gets inlined into its callers (which happens with -O2), it "returns" the result on a x87 FPU register. Then `timevar_accumulate()` computes the difference between this 80-bit number a= nd a 64-bit double stored in the timer structure. So when `clock()` returns 15 at both start and end measurements, this code basically subtracts 15 * (1.0 / 1000) stored with 64-bit precision from itself computed with 80-bit precisi= on, and the difference is 8.673617379884035472e-19. When `clock()` returns 15 f= or all measurements during a single cc1 run, the total time and each phase time are equal to this same constant, and the sum of phase times is twice the to= tal time: Timing error: total of phase timers exceeds total time. user 1.734723475976807094e-18 > 8.673617379884035472e-19 Maybe GCC should round such ridiculously small intervals to zero?=