public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "madhur4127 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug translation/95563] New: High memory usage and possible infinite loop
Date: Sat, 06 Jun 2020 14:00:14 +0000	[thread overview]
Message-ID: <bug-95563-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95563

            Bug ID: 95563
           Summary: High memory usage and possible infinite loop
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: translation
          Assignee: unassigned at gcc dot gnu.org
          Reporter: madhur4127 at gmail dot com
  Target Milestone: ---

Created attachment 48693
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48693&action=edit
Original code

Attached simplified.cc, which aims to be a complete example. For the original
code please see [1] (at bottom).

simplified.cc aims to be minimal in nature. But please verify the issue with
the original code.

Logic: Computing a binomial coefficient over a few iterations using a Modular<>
struct which is a wrapper over integer supporting modular arithmetic.
Combinatorics struct contains two arrays of "Modular" integers, one for
factorials and other for inverse factorials (modular multiplicative inverse of
the corresponding factorial).

On Linux, compilation took over 3.3GB of memory and 100% CPU utilization for
over 30 minutes, and thereafter I had to kill it. This hints for an infinite
loop.

command: g++ simplified.cc -o simplified
GCC version: Default GCC package (gcc 10.1.0-2) of Arch Linux
Target: x86_64-pc-linux-gnu

If the issue is simple to fix, then I would like to fix it for GCC (some
pointers would be appreciated as I have no experience in developing compilers).

References:
1. Original Code:
https://gist.github.com/madhur4127/4eb29246463ed5a0538e1d9c8a2a7192

             reply	other threads:[~2020-06-06 14:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-06 14:00 madhur4127 at gmail dot com [this message]
2020-06-06 14:04 ` [Bug translation/95563] " madhur4127 at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-95563-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).