Article View: gnu.gcc.bug
Article #733gcc 1.36 and -fwritable-strings
From: Chris Thewalt
Date: Thu, 19 Oct 1989 16:50
Date: Thu, 19 Oct 1989 16:50
59 lines
2389 bytes
2389 bytes
Hello. I am using gcc 1.36 on a MicroVAX running Ultrix 2.2. I tried
to compile the following simple program without the -fwritable strings
and get a bus error, but it works with the flag. I don't quite
understand this since I am not attempting to write into any string
constants. A script of the session follows:
Script started on Thu Oct 19 12:41:58 1989
% cat ttt.c
#include <stdio.h>
main()
{
char *p[3], w[27], *q = w;
register int i;
sscanf("plan-plan","%s",p[0] = q);
q += strlen(q) + 1;
sscanf("lin-lin", "%s",p[1] = q);
q += strlen(q) + 1;
sscanf("lin-plan", "%s",p[2] = q);
for(i=0;i < 3;++i)
printf("%s\n",p[i]);
}
% gcc -v -o ttt ttt.c
gcc version 1.36
/usr/misc/.gnu/lib/compilers/gcc-cpp -v -undef -D__GNUC__ -Dvax -Dunix -D__vax__ -D__unix__ ttt.c /usr/tmp/cc022254.cpp
GNU CPP version 1.36
/usr/misc/.gnu/lib/compilers/gcc-cc1 /usr/tmp/cc022254.cpp -quiet -dumpbase ttt.c -version -o /usr/tmp/cc022254.s
GNU C version 1.36 (vax) compiled by GNU C version 1.36.
default target switches: -munix
as -o ttt.o /usr/tmp/cc022254.s
ld -o ttt /lib/crt0.o ttt.o /usr/misc/.gnu/lib/compilers/gcc-gnulib -lc
% ttt
Bus error
% gcc -fwritable-strings -v -o ttt ttt.c
gcc version 1.36
/usr/misc/.gnu/lib/compilers/gcc-cpp -v -undef -D__GNUC__ -Dvax -Dunix -D__vax__ -D__unix__ ttt.c /usr/tmp/cc022260.cpp
GNU CPP version 1.36
/usr/misc/.gnu/lib/compilers/gcc-cc1 /usr/tmp/cc022260.cpp -quiet -dumpbase ttt.c -fwritable-strings -version -o /usr/tmp/cc022260.s
GNU C version 1.36 (vax) compiled by GNU C version 1.36.
default target switches: -munix
as -o ttt.o /usr/tmp/cc022260.s
ld -o ttt /lib/crt0.o ttt.o /usr/misc/.gnu/lib/compilers/gcc-gnulib -lc
% ttt
plan-plan
lin-lin
lin-plan
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Christopher Robin Thewalt These opinions are not necessarily
thewalt@ce.cmu.edu shared by my employer...
Carnegie Mellon University
Technical Details
Message-ID:
<THEWALT.89Oct19125053@RITZ.ce.cmu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!iuvax!cica!tut.cis.ohio-state.edu!pt.cs.cmu.edu!thewaltShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!iuvax!cica!tut.cis.ohio-state.edu!pt.cs.cmu.edu!thewalt From: thewalt@RITZ.ce.cmu.edu (Chris Thewalt) Newsgroups: gnu.gcc.bug Subject: gcc 1.36 and -fwritable-strings Message-ID: <THEWALT.89Oct19125053@RITZ.ce.cmu.edu> Date: 19 Oct 89 16:50:53 GMT Distribution: gnu Organization: Dept. of Civil Engineering, Carnegie Mellon University, Pittsburgh, PA Lines: 59