gcc bug

Randolph Wilhoit wilhoit@trcdec.tamu.edu
Tue May 2 19:20:00 GMT 2000

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"};
  printf("%s\n", strar);
  strcn("string constant");

void strcn(char *sa)

Randolph Wilhoit

1400 Glade
College Station, TX  77840

More information about the Gcc-bugs mailing list