This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c/5484: Maybe an array size problem



>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]