From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7EEA63857023; Sun, 4 Apr 2021 06:54:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7EEA63857023 From: "izbyshev at ispras dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/99903] New: 32-bit x86 frontends randomly crash while reporting timing on Windows Date: Sun, 04 Apr 2021 06:54:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: 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 cf_gcchost cf_gcctarget cf_gccbuild 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: Sun, 04 Apr 2021 06:54:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99903 Bug ID: 99903 Summary: 32-bit x86 frontends randomly crash while reporting timing on Windows Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: izbyshev at ispras dot ru Target Milestone: --- Host: i686-w64-mingw32 Target: i686-w64-mingw32 Build: i686-w64-mingw32 Created attachment 50503 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D50503&action=3Dedit A reproducer Running cc1 from i686-w64-mingw32-gcc[1] with timing report enabled (e.g. without `-quiet` or with `-ftime-report`) may randomly crash on Windows. A reproducer script is attached (tested on two Windows 10 1909 x64 machines= ). The time to reproduce varied from seconds to half an hour. Running multiple= cc1 to increase load appears to help, but is not required; just running a single cc1 in a loop is enough too. The crash manifests as silent exit with code 3221225477 (0xc0000005; EXCEPTION_ACCESS_VIOLATION). Debugging showed the following. The eventual crash is actually a nested one. It happens at [2] while report= ing an ICE because `context->printer` is NULL (which, by itself, looks like a separate bug). The initial crash is triggered by `gcc_unreachable()` in `timer::validate_phases()`[3]. #0 0x0125be91 in pp_format(pretty_printer*, text_info*) () #1 0x0125146b in diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) () #2 0x01251bd7 in diagnostic_impl(rich_location*, diagnostic_metadata const= *, int, char const*, char**, diagnostic_t) () #3 0x012521b8 in internal_error(char const*, ...) () #4 0x01528a96 in fancy_abort(char const*, int, char const*) () #5 0x014f9e9c in timer::validate_phases(_iobuf*) const [clone .cold] () #6 0x009400d3 in timer::print(_iobuf*) () #7 0x00942422 in toplev::~toplev() () #8 0x01526003 in main () And `gcc_unreachable()` is reached because `phase_user > total->user * tolerance` is true. GCC doesn't print anything when run from `repro.py` bec= ause of output buffering, but I extracted one message from memory: Timing error: total of phase timers exceeds total time. user 1.734723475976807094e-18 > 8.673617379884035472e-19 I couldn't reproduce this with 64-bit x86 GCC. [1] https://github.com/msys2/MINGW-packages/tree/5d82e17a56a3216a54dbb5924b92c9= 6284ae5c97/mingw-w64-gcc [2] https://gcc.gnu.org/git?p=3Dgcc.git;a=3Dblob;f=3Dgcc/diagnostic.c;h=3Ded52b= c03d17afa2d7ac3419beb73e8f59b6f392b;hb=3Dreleases/gcc-10.2.0#l1077 [3] https://gcc.gnu.org/git?p=3Dgcc.git;a=3Dblob;f=3Dgcc/timevar.c;h=3Da3a882d3= 2040db6503260ab51ee4bf338c4aa2b5;hb=3Dreleases/gcc-10.2.0#l628=