Return to BSD News archive
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!news.kei.com!news.mathworks.com!udel!news.sprintlink.net!howland.reston.ans.net!agate!maddox From: maddox@redwood.CS.Berkeley.EDU (William Maddox) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: Berkeley Free CC? (Was: Re: Slight flame from Linux user) Date: 9 Jun 1995 09:45:06 GMT Organization: University of California, Berkeley Lines: 209 Message-ID: <3r9572$pqs@agate.berkeley.edu> References: <3ql3gd$je2@bell.maths.tcd.ie> <3r595f$h9t@fido.asd.sgi.com> <3r7jvu$8bv@coli-gate.coli.uni-sb.de> <D9vno8.BH@kithrup.com> NNTP-Posting-Host: redwood.cs.berkeley.edu I have some knowledge of of 'lcc', having partially ported it to FreeBSD. In article <D9vno8.BH@kithrup.com>, Sean Eric Fagan <sef@kithrup.com> wrote: >lcc is even less distributable than gcc is, and cannot be safely distributed >by anyone make CD-ROMs (or anyone making *any* money distributing). Without further clarification from the authors, I would have to agree with this, though it is not at all clear that the authors would object. If there is interest in 'lcc', it would be worth contacting the authors. Actually, I intend to do this in any case. The language of the license is legally sloppy in at least on respect, and I have considered suggesting to Drs. Fraser and Hanson that they reissue it with several questions dealt with more explicitly. >Yes, it's considerably smaller than gcc, and it also generates pretty bad >code. (Well, okay, not *bad*, just not optimized much, if at all.) Lcc is not a highly-optimizing compiler. As far as its pretensions to sophistication go, it is best compared with pcc. The local code generation (instruction selection) strategy used by lcc is similar in some respects to the table-driven scheme used in pcc, but is much more disciplined. By a very narrow definition of 'optimal' used in most papers on the topic, the method used by lcc is capable of 'optimal' local instruction selection. In practice, however, good instruction selection cannot be separated from register allocation (and, these days, instruction scheduling), and these are exactly the features of the real-world problem that the aformentioned theoretical optimality criterion ignores. Moreover, the code quality cannot be any better than the instruction cost information given in the machine description, which is simply wrong for much of the x86 description shipped with the compiler. The main problem with lcc on the x86 is that many of the engineering tradeoffs in its design favor RISC processors, with a large number of uniformly-treated registers. In a compiler that allocates registers at the basic block level, it is extremely rare to run out of registers, thus the authors made a conscious decision to keep the register allocator simple at the expense of code quality when the occasional spill to memory is required. These tradeoffs were defended in quantitative studies. (Several aspects of the design lcc were the subject of research papers.) As far as I can tell, though, the port to the x86 was an afterthought, done rather late, and the experience did not feed back into the design. While it is claimed that lcc is a production compiler, it is clear from the lack of adequate debugging support for the other supported architectures that the SPARC port is the principal one, with the MIPS probably usable as well. I speculate that the x86 port was provided mainly to broaden the appeal of the book, as well as to provide a more pathological architecture example for tutorial purposes! But, yes, the book. Nearly all of the code of lcc appears in the book: Christopher Fraser and David Hanson "A Retargetable C Compiler: Design and Implementation" Benjamin-Cummings 1985 This book is a detailed exposition of the program as a 'literate program'. This documentation is invaluable to those who want to do their own ports to other processors, or use the compiler as a base for projects of their own. >lcc is useful for two things: it's a lot faster than gcc, and there is a >version of lint based on it. The compiler is also much smaller, and easier to understand and modify. For these reasons, it most likely has fewer bugs. At least the chances of introducing new bugs accidently when attempting to modify or extend it are much less, provided that you have availed yourself of the the extensive documentation, which covers not only the "what", but the "why" of the design. > However, the rather-restrictive license that comes with it makes it safer > for me to avoid it. It depends what you want to do with it. For personal hobby use, the license is no more restrictive than than the GPL or the BSD license, and I rather like the fact that it doesn't require me to retain nearly a full page of legal boilerplate in every source file -- the single COPYRIGHT file suffices. Admittedly, the situation for commercial use is unclear, but the fact that the license does include specific permissions for certain kinds of commercial use, as well as an invitation to negotiate other terms, indicates that the authors are not aggressively anti-commercial. The provisions of the licence seem primarily focussed on receiving due credit for their work, and preserving the integrity of code which is represented as their work. I doubt the authors expect to make a dime on lcc beyond the royalties they get for their book. Unlike Linus, however, it does seem that they are not willing to condemn themselves in advance to being left on the financial sidelines should lcc turn out to be commercially viable in some other way. I certainly cannot fault them for this. The complete text of the file "CPYRIGHT" from the lcc-3.2 distribution follows, with my commentary set in brackets. William Maddox maddox@cs.berkeley.edu ------------- The authors of this software are Christopher W. Fraser and David R. Hanson. Copyright (c) 1991,1992,1993,1994,1995 by AT&T, Christopher W. Fraser, and David R. Hanson. All Rights Reserved. Permission to use, copy, modify, and distribute this software for any purpose, subject to the provisions described below, without fee is hereby granted, provided that this entire notice is included in all copies of any software that is or includes a copy or modification of this software and in all copies of the supporting documentation for such software. THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. [ Standard stuff for copyrighted freeware ] lcc is not public-domain software, shareware, and it is not protected by a `copyleft' agreement, like the code from the Free Software Foundation. lcc is available free for your personal research and instructional use under the `fair use' provisions of the copyright law. [ As far as I can tell, this statement is legally flawed from a technical standpoint, and is essentially a tautology of the form "I give you permission to do what the law already allows". Fair use is not a statutory provision of the copyright law, rather, it is a doctrine in the case law of copyright that recognizes certain exceptions to the author's exclusive right to control the reproduction of his work for certain purposes, primarily scholarly research. If I buy a copy of a book, for example, the doctrine of fair use allows me to quote a paragraph in a book review or critical essay, whether the author has given me permission or not. In any case, this provision neither extends nor restricts the permission to use and distribute granted in the first paragraph. ] You may, however, redistribute the lcc in whole or in part provided you acknowledge its source and include this COPYRIGHT file. [ This merely restates provisions of the first paragraph. ] You may not sell lcc or any product derived from it in which it is a significant part of the value of the product. Using the lcc front end to build a C syntax checker is an example of this kind of product. [ This is the sticky one. While the examples of a forbidden 'product' here and in the following paragraphs are derivative works, i.e., other programs incorporating all or part of lcc, suggesting this as the intent, the first sentence as it stands would appear to prohibit inclusion on commerical CD-ROMs. I'd certainly get a written clarification from the authors before risking getting on the wrong side of AT&T's lawyers! ] You may use parts of lcc in products as long as you charge for only those components that are entirely your own and you acknowledge the use of lcc clearly in all product documentation and distribution media. [ In contrast to the previous paragraph, this seems to permit money changing hands for a product involving lcc. The question here is whether selling a CD is adding additional value to free software, simply by organizing it into a collection and making it more easily obtained and stored, as many CD vendors apparently claim to be doing, or whether it is actually selling the software. This a subtle point, and one I'll leave an opinion on to the lawyers! ] You must state clearly that your product uses or is based on parts of lcc and that lcc is available free of charge. You must also request that bug reports on your product be reported to you. [ Standard freeware stuff ] Using the lcc front end to build a C compiler for the Motorola 88000 chip and charging for and distributing only the 88000 code generator is an example of this kind of product. [ In this case, the product is a "bolt-on" enhancement to be added by the lcc user, and is not a derivative work. It is not clear that the lcc authors have any control over such code at all if is genuinely distinct from, and not in any way derived from, the actual code of lcc, and is furthermore distributed separately. The question here is whether the authors would permit a commercial vendor to provide lcc on the distribution media for his product, provided that it was clear that the customer was paying for the vendor's added-value, and that lcc distribution was sufficiently distinguishable from the vendor's product for the customer to be able to exercise the rights granted by this license independently of any restrictions placed on the use of the vendor's own contribution. ] Using parts of lcc in other products is more problematic. For example, using parts of lcc in a C++ compiler could save substantial time and effort and therefore contribute significantly to the profitability of the product. This kind of use, or any use where others stand to make a profit from what is primarily our work, is subject to negotiation. [ The authors clearly prohibit inclusion in a commercial derivative work under the terms of this licence, but invite negotiation of alternate terms. ] Chris Fraser / cwf@research.att.com David Hanson / drh@cs.princeton.edu Fri Jun 17 11:57:07 EDT 1994