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]

gcc bug


Bug Report for gcc

I am not sure if this behavior would be called a "bug", but
it is incompatible with some libraries and other compilers.

I am running it on Red Hat Linux, version 6.0
The output of gdd -v is:

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs

gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)


The following short program reproduces the problem. The first call to
strcn(strar) works ok but the second call, strcn("string contstant")
generates a "Segmentation fault {core dumped}" message when the
command sa[6] = '_' is executed.

A C compiler running under Windows NT and the cc compiler on the Dec
alpha Computer do not give this error.

Also the gdb debugger in Linux can execute the command, set sa[6] = '_'
without an error.

#include <stdio.h>
void strcn(char*);
main ()
{
  char strar[]={"string array"};
  strcn(strar);
  printf("%s\n", strar);
  strcn("string constant");
}

void strcn(char *sa)
{
   sa[6]='_';
}


Randolph Wilhoit
wilhoit@trcdec.tamu.edu

1400 Glade
College Station, TX  77840



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