Re: Deterministic compilers

"Jan Gray" <jsgray@acm.org>
7 May 2001 23:16:58 -0400

          From comp.compilers

Related articles
Deterministic compilers o.myrk@aprote.com (Oleg Mürk) (2001-05-03)
Re: Deterministic compilers world!bobduff@uunet.uu.net (Robert A Duff) (2001-05-07)
Re: Deterministic compilers christian.bau@isltd.insignia.com (Christian Bau) (2001-05-07)
Re: Deterministic compilers jsgray@acm.org (Jan Gray) (2001-05-07)
Re: Deterministic compilers walter@digitalmars.com (walter) (2001-05-13)
| List of all articles for this month |
From: "Jan Gray" <jsgray@acm.org>
Newsgroups: comp.compilers
Date: 7 May 2001 23:16:58 -0400
Organization: Gray Research LLC
References: 01-05-011
Keywords: optimize
Posted-Date: 07 May 2001 23:16:58 EDT

"Oleg Mürk" <o.myrk@aprote.com> wrote in message
> I've got a strange question: are contemporary compilers (for C++ or Java)
> deterministic?


Certainly it is a goal that contemporary compilers strive to achieve.
For example, long ago, I recall removing such a 'nondeterminism' from
a development build of the Microsoft C/C++ compiler, that emerged when
the address of one data structure was inducing an ordering upon
another. (Across hosts and situations, the addresses returned from an
identical sequence of calls on the memory allocator may vary.)


Sometimes that goal is set aside in pursuit of others. Incremental
compilers and linkers, such as Microsoft Visual C++, when run
incrementally, may produce equivalent but binary-different results if
the order or repetition of compilation and linking steps varies. For
example, if you compile and link 1.c and 2.c into 12.exe, then change
2.c into 2.c' and rebuild incrementally, the resulting 12.exe' may
differ, even in size, from the products of a clean build of 1.c and
2.c'. That's a price you pay for sub-second rebuilds and
edit-and-continue-debugging.


By the way, there are some "compilers", such as Xilinx's FPGA netlist
-> configuration bitstream compiler, that provide a command line
option to deterministically (repeatably) seed non-deterministic
optimizations. That way you can run several iterations of the
compilation and get slightly different results each time, and keep the
"best" result. (Here "best" means "lowest worst-case cycle time".)
This kind of option is helpful for a compilation process where each
local decision can have global ramifications, and where the compile
time may be minutes or even hours.


Jan Gray, Gray Research LLC


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.