egcs bug? (fwd)

Alexandre Oliva oliva@dcc.unicamp.br
Mon Dec 21 10:50:00 GMT 1998


On Dec 20, 1998, Paul Ezust <ezust@zeus.cas.suffolk.edu> wrote:

> I was confused by the three different compiler behaviors that
> I described in my first message:

>    gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
>    gives an "Internal compiler error".

This was a bug that was fixed in release 1.1 (or was it 1.0.3?)

>    gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
>    compiles it but produces a run-time error (segmentation fault)

>    Centerline C++ compiler compiles and runs it with no problem.
>    (Centerline sells a unix IDE called ObjectCenter.)

> One colleague seems to think that compiling it so that it produces
> a run-time error is the correct way to handle that error.
> That makes me a bit queasy.

A program that tries to modify a literal string is completely
unpredictable, because the Standard says it produces undefined
behavior.  It could wipe out your hard disk, start `hack' or even
reboot the universe :-)

Segmentation fault is fine, and allowing the modification is fine
too.  Producing any run-time error other than segmentation fault would 
be probably too costly (checking every access) or too unportable
(catching SIGSEGV).

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil




More information about the Gcc-bugs mailing list