This is the mail archive of the gcc@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]

strange seg-fault


hi!

i'm using gcc 2.95.3 and glibc 2.1.3 on linux 2.2.15-4. here's my system
info:

[soubhik@cseproj22 tmp]$ uname -a 
Linux cseproj22.cse.iitk.ac.in
2.2.15-4mdk #1 Wed May 10 15:31:30 CEST 2000 i686 unknown
[soubhik@cseproj22 tmp]$     

[soubhik@cseproj22 tmp]$ gcc -v 
Reading specs from
/usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/specs gcc version 2.95.3
19991030 (prerelease)
[soubhik@cseproj22 tmp]$   

now following is a tiny program, which is causing a seg-fault, apparently
without any valid reason:

#include <stdlib.h>
#include <stdio.h>

void enumerate_tuples(void);

int main(void)
{
  enumerate_tuples();
  //exit(1);
  return 0;
}


void enumerate_tuples(void)
{
  unsigned char no_of_params, i;
  long *up, *lo, *tuple;
  unsigned long long no_of_tuples, j;

  printf("NoOfParams: ");
  scanf("%d", &no_of_params);

  return;
}

if i bring the call to 'exit()' in 'main()' out of the comment then
there's no seg-fault...... any idea, why is this happening? what shud i do
to get rid of this?

one more question: is there any printf/scanf conversion charecter for the
type 'long long'?...

Regards,
soubhik.


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