9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] GUI toolkit for Plan 9
@ 2002-02-26 20:28 presotto
  2002-02-26 21:34 ` [9fans] compilers - was " Matt H
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: presotto @ 2002-02-26 20:28 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1687 bytes --]

You're right, there's plenty of blame to go around.  More
than once I was hoist on my own petard with C aliasing
and saved by lots of 'volatile's.  Not surprisingly I
was screwed more than once by tail recursion optimizations
on Sparc's (fun with register files) by lcc.  Ditto with
instruction ordering on MIPS.  In all cases turning off
optimization fixed the problem, regardless of where the
fault lay.  Hence, I can understand Rob's worry about
optimization being an option rather than a requirement.

Programmers tend to know that they are treading where
lesser mortals fear to go when they up the optimization
level.  Especially with C, we are trained largely by
what works and what doesn't.  Moving from the VAX to the
68020 uncovered lots of null references that were going
unnoticed in the past.  Ditto for other coding outside
the spec.  If nothing slaps you down, you get complacent.
Hence, we tend to accept the resulting errors and just
back off optimization when it fails.  We often don't report
the bug because

1) not knowing the compiler writer, its often hard
to say, ``When I use the -O256 flag, my 150,000 line program
acts funny'' and expect to get any satisfaction.
2) we're afraid after 2 weeks of debugging it'll turn out
to be our fault
3) once your code has been rewritten by a machine, its
often incredibly hard to figure out what's broken
4) its not my job, man

If things don't make it through with optimization turned
off, then we report bugs because then we know its not
our fault and have no recourse (except the first day
trying to program around it).  Hence, optimizing compilers
tend to self select for retaining bugs.

[-- Attachment #2: Type: message/rfc822, Size: 2966 bytes --]

From: Mike Haertel <mike@ducky.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] GUI toolkit for Plan 9
Date: Tue, 26 Feb 2002 11:47:19 -0800 (PST)
Message-ID: <200202261947.g1QJlJ043207@ducky.net>

 From 9fans-admin@cse.psu.edu Tue Feb 26 11:06:34 2002
From: presotto@plan9.bell-labs.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] GUI toolkit for Plan 9
Date: Tue, 26 Feb 2002 14:05:49 -0500

>However, it seems to be an
>accepted consequence amongst compiler writers to trade off
>possible incorrect code generation against probable speed
>gains.  I've been burned numerous times by upping the optimization
>level in compilers including gcc.  This is not a new development.
>It was just as true 30 years ago with the fortran and PL1 compilers
>I used.

I'm not convinced that it's necessarily the compiler writers at
fault in many of these cases.  Certainly there are compiler and
optimizer bugs, and probably the more optimization you apply the
more likely you are to tickle these bugs.  You can blame the compiler
for those.

But, at least in the case of C, there are numerous cases where
people write code that is semantically undefined according to the
detailed rules of the C standard, but does what they want under
particular compilers or levels of optimization.  (E.g. how many of
you have assumed that local variables not declared volatile will
hold their values across a longjmp?)

So who to blame?  The compiler writer, who assumes the code being
compiled is standards-conforming?  The standards committee, who get
to decide which programming idioms will have defined behavior?
The programmer, who often doesn't really understand the rules of
the language?  The authors of programming textbooks, who often
downplay or omit these issues entirely?

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2002-03-01 13:25 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-26 20:28 [9fans] GUI toolkit for Plan 9 presotto
2002-02-26 21:34 ` [9fans] compilers - was " Matt H
2002-02-26 22:06   ` Theo Honohan
2002-02-27  0:21   ` Mike Haertel
2002-02-28 15:11     ` AMSRL-CI-CN
2002-02-28 16:55       ` Thomas Bushnell, BSG
2002-02-27  6:54 ` [9fans] " Eric Dorman
2002-02-27 10:20   ` Thomas Bushnell, BSG
2002-02-27 10:51     ` Lucio De Re
2002-02-27 13:27       ` Boyd Roberts
2002-02-27 14:20       ` Ish Rattan
2002-02-27 22:44       ` Thomas Bushnell, BSG
2002-02-28  4:41         ` Lucio De Re
2002-02-28 10:19           ` Thomas Bushnell, BSG
2002-02-28 10:14       ` Thomas Bushnell, BSG
2002-02-28 10:49         ` Matt H
2002-03-01 13:25           ` chad
2002-02-28  3:26     ` [9fans] GUI toolkit for Plan 9 [really GPL again!] Eric Dorman
2002-02-28  9:57     ` [9fans] GUI toolkit for Plan 9 ozan s yigit
2002-02-28 14:55 ` AMSRL-CI-CN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).