🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.msdos.programmer
1 messages
1 total messages Started by Paul Tomblin Mon, 19 Feb 1990 14:42
Strange misoptimization in Turbo C
#1281
Author: Paul Tomblin
Date: Mon, 19 Feb 1990 14:42
24 lines
1694 bytes
Has anybody seen this?  Has Borland?   Anybody know why it occurs?

I've just received CXL5.1, and was recompiling the demo program with Turbo C
2.0 (with all the patches, I think), and was getting some pretty strange
behaviour.  In the menuing demo, after choosing one of the options that
toggles yes to no, I got a screen full of garbage, and many errors later on
because the string space seemed a little corrupt.  Investigation showed that
the culprit was the following line:

    strcpy(yn,strcmp(yn,"yes")?"yes":" no");

in toggle_yn().  The temporary pointer that should have been pointing to the
string " no", was instead pointing into the middle of some other very long
string.  I tried turning off the questionable optimizations like -Z and even
-O, but to no avail.  It did work, however, if I turned off the "merge
duplicate strings" (-d) option.  I really like the idea of this option,
since it can make quite a difference, so I'd like to know if there is a
patch to fix this.  I've never seen this problem before in any other code
I've compiled.

-- 
Paul Tomblin nrcaer!cognos!geovision!pt or uunet!geovision!pt
Life: Loath it or ignore it, you can't like it.  (Marvin)
(My employer may not agree with my opinions, especially my .signature)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads