public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: gabrielmat@hotmail.com
To: gcc-gnats@gcc.gnu.org
Subject: c/5484: Maybe an array size problem
Date: Thu, 24 Jan 2002 18:46:00 -0000	[thread overview]
Message-ID: <20020125023608.26828.qmail@sources.redhat.com> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]


>Number:         5484
>Category:       c
>Synopsis:       Maybe an array size problem
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 24 18:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     gabrielmat@hotmail.com
>Release:        gcc 3.0.2
>Organization:
>Environment:
i586 pc, using gcc within DJGPP (for msdos)
>Description:
When I try to create the primos array of that size (UINT_MAX/5), I got the error "Internal compiler error in assign_stack_temp_for_type, at function.c:657". It doesn´t
have that problem with a minor size.
>How-To-Repeat:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#define NUM_MAX UINT_MAX
#define OUTPUT_FILE "primos.txt"

int main()
{
   unsigned int primos[NUM_MAX/5], n_primos, num, i;
   FILE *output;
   primos[0] = 2;
   n_primos = 1;
   output = fopen(OUTPUT_FILE, "w");
   fprintf(output, "\n\nN§ primos entre 1 y %i:\n\n1", NUM_MAX);
   for(num = 3; num <= NUM_MAX; num++) {
       for(i = 0; i <= (n_primos - 1); i++) {
           if( fmod(num, primos[i]) == 0 )
               break;
           else if( i == (n_primos - 1) ) {
               primos[n_primos] = num;
               n_primos++;
               fprintf(output, " %i", num);
               break;
           }
       }
   }
   fprintf(output, "\nN§ primos encontrados: %i", n_primos+1);
   exit(0);
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-01-25  2:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-24 18:46 gabrielmat [this message]
2002-04-02 19:44 rth

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=20020125023608.26828.qmail@sources.redhat.com \
    --to=gabrielmat@hotmail.com \
    --cc=gcc-gnats@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).