|
|
Subscribe / Log in / New account

pcc seeks contributions to reach 1.0 milestone

pcc, the portable C compiler, has teamed up with the BSD Fund to try to attract donations to fund the completion of a "usable" 1.0 release. The BSD folks have long been dissatisfied with GCC, but Linux developers have eyed pcc (and others) as well. LWN looked at pcc a little over a year ago. (Thanks to Brian Plummer).

to post comments

BSD Dissatisfied with gcc... why?

Posted Nov 17, 2008 17:25 UTC (Mon) by pr1268 (guest, #24648) [Link] (21 responses)

Just curious, what exactly is BSD's dissatisfaction with GCC? I'm not saying that the compiler world begins and ends with GCC, but it certainly commands higher respect and market share amongst the non-Microsoft and Sun/Solaris computing communities (but I've used GCC with success on these platforms as well).

Is this just more BSD v. GNU/Linux politics (SSH comes to mind here)?

BSD Dissatisfied with gcc... why?

Posted Nov 17, 2008 17:29 UTC (Mon) by rsidd (subscriber, #2582) [Link] (18 responses)

How, exactly, does SSH come to mind here? As for the BSD community's issues with gcc, the licence is one issue, but not the only one.

BSD Dissatisfied with gcc... why?

Posted Nov 17, 2008 17:48 UTC (Mon) by pr1268 (guest, #24648) [Link] (17 responses)

My thoughts on SSH (and my comment above) were influenced by some flame wars I read about (the Broadcom BSD driver row in particular). I probably should have specified OpenSSH. However, I really don't mean to dredge up reminders of how BSD v. GNU/Linux politics can get ugly.

Thanks for reminding me of the licensing incompatibility--that puts things in a better perspective.

BSD Dissatisfied with gcc... why?

Posted Nov 17, 2008 18:55 UTC (Mon) by mheily (subscriber, #27123) [Link]

The previous LWN article on pcc cited in the summary explains why there is interest in an alternative to GCC. Licensing isn't the main issue. The BSDs are interested in a fast, stable, simple, reliable, and portable C compiler. If PCC can be improved to make it production-ready, it would serve their needs better than GCC does today.

BSD Dissatisfied with gcc... why?

Posted Nov 17, 2008 22:14 UTC (Mon) by EmbeddedLinuxGuy (guest, #35019) [Link] (15 responses)

Thanks for reminding me of the licensing incompatibility

If you are implying that GPL and BSD licenses are incompatible, this is not accurate. Of course they are compatible; how do you think the project has gotten by so far?

BSD Dissatisfied with gcc... why?

Posted Nov 17, 2008 22:54 UTC (Mon) by nix (subscriber, #2304) [Link] (14 responses)

They're not incompatible, but the stated reason for pcc's being revived in
the first place rather than working on something non-stoneage was a fear
of the GPL / desire to have absolutely nothing GPLed in their entire
distro.

I consider this utter lunacy, but if they want to waste their time to that
extent, well, it's their time to waste.

BSD Dissatisfied with gcc... why?

Posted Nov 17, 2008 23:55 UTC (Mon) by jzbiciak (guest, #5246) [Link] (11 responses)

If GCC's GPL license were the driving issue, then why not contribute to LLVM's Clang and get a thoroughly modern compiler with a very BSD-like license? PCC dates to the 70s and GCC to the 80s.

LLVM's license reads an awful lot like the BSD-with-advertising-clause, just with UIUC's name subbed in.

http://llvm.org/releases/2.3/LICENSE.TXT

I suspect it's not just license.

I seem to recall a big part of the attractiveness of PCC was that it was very simple and fast. Advanced transformations and optimizations have greater likelihood of breaking a complex program. Aggressive optimizations push the semantics of the C language quite a bit, such that it's hard to write something like a kernel. Lately, it seems like nearly every major GCC release seems to break something subtly somewhere that was relying on a stronger guarantee than is offered by the standard.

BSD Dissatisfied with gcc... why?

Posted Nov 18, 2008 0:33 UTC (Tue) by dlang (guest, #313) [Link] (1 responses)

the fact that chips have been getting _much_ smarter and changing their internal architecture has meant that a lot of the optimizations that GCC tries so hard to do are not as useful as they used to be (and in some cases activly bad for current hardware).

this makes a simple compiler very attractive (at least in theory)

BSD Dissatisfied with gcc... why?

Posted Nov 18, 2008 8:18 UTC (Tue) by dgm (subscriber, #49227) [Link]

To disprove yourself, simply try LCC or other simple compiler, and watch the code run 2 or 3 times slower than the one generated by GCC (that is in turn two times slower than the one generated by other compilers).

The real problem with GCC is that it's overly complex (and slow) for the quality of optimizations it provides.

BSD Dissatisfied with gcc... why?

Posted Nov 18, 2008 0:42 UTC (Tue) by qg6te2 (guest, #52587) [Link] (8 responses)

it seems like nearly every major GCC release seems to break something subtly somewhere that was relying on a stronger guarantee than is offered by the standard.

"Stronger guarantee than offered by the standard"? I don't think such a thing exists. Not following standards is a very slippery path. If one writes code that does not follow the standard but rather some bastardised version of it, the resulting code is by default non-portable and likely to break across compilers (even on the same architecture). I've seen non-portable trickery where the entire point was to get a 5% speedup on a particular version of a compiler.

BSD Dissatisfied with gcc... why?

Posted Nov 18, 2008 1:49 UTC (Tue) by jzbiciak (guest, #5246) [Link] (3 responses)

Granted, since I follow Linux much, much more closely than BSD, I tend to hear it from the Linux kernel guys. Here's a thread that captures what I'm talking about.

Nice example...

Posted Nov 18, 2008 17:24 UTC (Tue) by daney (guest, #24551) [Link] (2 responses)

That is an excellent example, one that clearly shows that the GCC developers being responsive by carefully analysing the situation and changing their compiler to address the concerns raised by the Linux kernel developers.

There was some initial contention, but once the situation was well understood, the desired results were obtained. There are some who argue based on the axiom that GCC == BAD, but I don't think it holds in the case you mention.

Nice example...

Posted Nov 18, 2008 17:38 UTC (Tue) by jzbiciak (guest, #5246) [Link] (1 responses)

I don't come down on the side of "GCC == BAD" at all. What I was pointing out, though, is that the C standard and its wiggle room are at odds with things like kernels and multithreaded programs. If you can only rely on what the C standard guarantees, then it's much harder to do useful things efficiently.

More aggressive optimizations will rely on this wiggle room and sometimes break things. That's a headache for kernel developers. Sure, GCC may get fixed, but breaking to begin with was an annoyance. If the break causes subtle problems, diagnosing the issue could be very difficult.

This is where a simpler compiler can be more effective. If it provides very simple semantics (rather than the extraordinary wiggle room the standard provides), it becomes easier to reason about the correctness of the program. Yes, it's less portable to other compilers, but as long as the compiler itself is portable, what's the issue?

After all, you don't see many Linux builds that don't use GCC (although there are a few...).

Nice example...

Posted Nov 18, 2008 19:07 UTC (Tue) by dlang (guest, #313) [Link]

multi-threaded programming will be in much better shape (standards wise) in a couple years.

defining this area is one of the bigger changes in the new POSIX, C, and C++ standards that are nearing completion (POSIX is complete, C is expected next year, C++ sometime after that)

BSD Dissatisfied with gcc... why?

Posted Nov 18, 2008 10:42 UTC (Tue) by etienne_lorrain@yahoo.fr (guest, #38022) [Link] (3 responses)

> Not following standards is a very slippery path.

Even when the standards are very unclear, like volatile structure of bitfields considered by GCC (in C) as structure of volatile bitfields, resulting in reads of volatiles on an "C" whole structure write?
Moreover, I still do not understand how in C++ I am supposed to use volatile integers - when I want to write a non volatile integer to it or read it into a non volatile integer - i.e. the basic use of volatile (register mapped) integers. Obviously I do not want warnings or a cast of my volatile register mapped integer into non volatile...

BSD Dissatisfied with gcc... why?

Posted Nov 19, 2008 14:36 UTC (Wed) by dgm (subscriber, #49227) [Link] (2 responses)

> the basic use of volatile (register mapped) integers

Wrong. I think you were thinking of the "register" keyword.
"Volatile" means that the contents of a variable can be changed externally at any time. Think, for instance, of a memory mapped hardware register. Basically it instructs the compiler to avoid certain optimizations based on knowledge of the previous value, and forces it to read it every time.

BSD Dissatisfied with gcc... why?

Posted Nov 19, 2008 20:57 UTC (Wed) by nix (subscriber, #2304) [Link]

In particular, 'volatile' is still useful. 'register' is, basically, not,
with the single rare exception of global register variables (a GCC
extension).

BSD Dissatisfied with gcc... why?

Posted Nov 20, 2008 10:34 UTC (Thu) by etienne_lorrain@yahoo.fr (guest, #38022) [Link]

> > the basic use of volatile (register mapped) integers
> Wrong. I think you were thinking of the "register" keyword.

No, I was and am still talking of "volatile".
The problem is that the C++ standard treats all attributes the same way, and gives examples with "const".
I do understand that to overwrite the "const" attribute, I need to do a dirty cast to non-const, but the basic use of volatile is to copy them into standard variables, at a controled place of the software:

volatile unsigned ethernet_status;
/* -> address of ethernet_status defined in the linker file */
int fct(void) {
unsigned status = ethernet_status; // single read of "ethernet_status"
return ((status & 1) || ((status & 2) ^ (status & 4)));
}

Now tell me how to put ethernet_status and fct() into a class and compile without warning and without casting ethernet_status to non-volatile...

But the worst for me is still considering a volatile structure of bitfields as a structure of volatile bitfields, even if I see no problem to consider a constant structure of bitfields as a structure of constant bitfields...
For instance:
volatile struct color_s { char red, green, blue, transparent; } volcolor;
int fct (void) {
struct color_s color = volcolor;
return color.red == color.blue;
}
Because volcolor is considered as a structure of volatile fields, volcolor is read twice (two byte access) when optimising.

BSD Dissatisfied with gcc... why?

Posted Nov 18, 2008 0:33 UTC (Tue) by EmbeddedLinuxGuy (guest, #35019) [Link] (1 responses)

the stated reason for pcc's being revived in the first place rather than working on something non-stoneage was a fear of the GPL / desire to have absolutely nothing GPLed in their entire distro.

What I have read from the BSD leadership explicitly denies this. See the interview in the Jem Report where Theo de Raadt says that replacing GPL-licensed code has "never really been the agenda". I don't deny that there may be BSD folks who would prefer an all-BSD-licensed distribution, but I have not seen this stated as a reason for anything.

Theo's point is that we should not be dependent on a software monoculture; which is the same reason we benefit from both KDE and GNOME, Linux and BSD, Firefox and Webkit, etc etc. I see nothing "anti-GPL" here.

BSD Dissatisfied with gcc... why?

Posted Nov 18, 2008 15:10 UTC (Tue) by nix (subscriber, #2304) [Link]

OK, right, my memory is flawed and I shouldn't post while high on
gamma-globulins.

BSD Dissatisfied with gcc... why?

Posted Nov 17, 2008 18:20 UTC (Mon) by endecotp (guest, #36428) [Link]

> Just curious, what exactly is BSD's dissatisfaction with GCC?

follow the link the the last LWN story.

BSD Dissatisfied with gcc... why?

Posted Nov 17, 2008 22:29 UTC (Mon) by DonDiego (guest, #24141) [Link]

It's not just BSD folks. gcc gets slower with every release, the code is generates is often of poor quality and bug reports are sometimes brushed aside and ignored.

pcc seeks contributions to reach 1.0 milestone

Posted Nov 17, 2008 20:03 UTC (Mon) by robert_s (subscriber, #42402) [Link] (4 responses)

Total waste of time (and now money). Time would be better spent working on Clang for LLVM. The only thing they can possibly inherit from pcc is poor design decisions.

pcc seeks contributions to reach 1.0 milestone

Posted Nov 17, 2008 22:12 UTC (Mon) by nix (subscriber, #2304) [Link] (2 responses)

But LLVM has the Wrong License, sigh.

pcc seeks contributions to reach 1.0 milestone

Posted Nov 17, 2008 23:55 UTC (Mon) by jzbiciak (guest, #5246) [Link] (1 responses)

Well, its license is very BSD-like. It's certainly not GPL.

pcc seeks contributions to reach 1.0 milestone

Posted Nov 19, 2008 20:46 UTC (Wed) by nix (subscriber, #2304) [Link]

Just... just... just forget everything I've posted for the last week.
Nearly all of it seems to be wrong. Posting when ill or when sickening up
for something seems to turn me into a babbling idiot incapable of adding
two and two without getting NaN.

pcc seeks contributions to reach 1.0 milestone

Posted Nov 19, 2008 11:10 UTC (Wed) by ragge (guest, #55254) [Link]

And that opinion is based on... on what?

Relying on Caldera?

Posted Nov 17, 2008 21:06 UTC (Mon) by dmarti (subscriber, #11625) [Link] (1 responses)

After Caldera became SCO, the company denied that it ever released "ancient Unix" for anything but "non-commercial use." Does anyone have a clear committment from Novell or any of the other Unix copyright holders to release this? Or are people relying on the 2002 letter from Bill Broderick?

Relying on Caldera?

Posted Nov 18, 2008 0:50 UTC (Tue) by JoeBuck (subscriber, #2330) [Link]

Oh, please. The press releases from Caldera announcing the source code release are on the record, and you can find them on the web. There was never any restriction on commercial use.

Here's a copy of the announcement, which for some odd reason you'll no longer find on SCO's site.

Given subsequent events, perhaps SCO can argue that their predecessor company had no right to do this, because Novell, not they, own Unix. But to say so would undercut their own argument in their legal troubles with Novell.

pcc has been making good progress

Posted Nov 17, 2008 21:57 UTC (Mon) by roskegg (subscriber, #105) [Link] (2 responses)

I've been watching the commits to the pcc tree, and am really impressed at the progress it is making. It really is fitting the bill of small, clean, fast, portable. Just recently support for inline functions was added.

The pcc project is small enough that a regular guy can wrap his head around it, whereas gcc takes a lot of effort.

Ragge deserves our support, and we can only benefit from pcc become better. It is already usable.

Someone here said pcc suffers from ancient bad design decisions. What would those be? The codebase is almost entirely new, very little of the original code remains.

pcc has been making good progress

Posted Nov 18, 2008 0:53 UTC (Tue) by robert_s (subscriber, #42402) [Link] (1 responses)

"Someone here said pcc suffers from ancient bad design decisions. What would those be? The codebase is almost entirely new, very little of the original code remains."

Exactly - so they're essentially scratchwriting a compiler, it's just everyone's afraid of saying that for some reason. Perhaps because it betrays the mammoth nature of the task.

pcc has been making good progress

Posted Nov 19, 2008 8:36 UTC (Wed) by ragge (guest, #55254) [Link]

Well, there were some maybe not so good design decisions in the compiler, but those that matters has been corrected. Hey, it's a small compiler, not so difficult to fix things :-)

pcc seeks contributions to reach 1.0 milestone

Posted Nov 18, 2008 3:55 UTC (Tue) by RandyBolton (guest, #6186) [Link] (12 responses)

I found this recent presentation from Anders Magnusson on the web that gives a good overview of the current state of PCC:

Bringing PCC into The 21th century
by Anders Magnusson
October 11, 2008
http://www.nycbsdcon.org/2008/files/magnusson_pcc.pdf

Good link

Posted Nov 18, 2008 7:59 UTC (Tue) by roskegg (subscriber, #105) [Link] (2 responses)

Ragge's presentation that you linked to was really nifty. I didn't realize a C compiler could be so simple.

I hope he finishes pdp10 support at some point, and that NetBSD and OpenBSD get ported to the PDP10. It would be a fun honeypot to leave running.

Good link

Posted Nov 18, 2008 16:03 UTC (Tue) by nix (subscriber, #2304) [Link] (1 responses)

The *very* early C compilers are even more stunningly simple, and they
probably work quite well for PDP10s, and are good examples even now of
simple parsers.

But if you want to get decent performance on modern hardware you *need*
things like speculative code motion (to avoid pipeline stalls), and if you
want that then you need dataflow analysis and I can see no way they can do
that with PCC without turning it into something quite different.

So perhaps they plan for this to stay forever in the ghetto of 1980s and
pre-1980s hardware? I'm not sure, but it hardly seems like an exciting
growth area to me.

Good link

Posted Nov 19, 2008 7:28 UTC (Wed) by ragge (guest, #55254) [Link]

Please look at the presentation again. The things you mentions are already put in the compiler. The initial design of the compiler made it very easy to add state-of-the-art optimizing stuff. I think especially the multi-class register allocator is one of the best available today.

Currently the code generated is between 0-10% slower than code generated by gcc, and most of the time "lost" is due to not-yet added optimizations. Still, the compiler runs around 15 times faster than gcc.

pcc seeks contributions to reach 1.0 milestone

Posted Nov 18, 2008 16:00 UTC (Tue) by nix (subscriber, #2304) [Link] (8 responses)

Good grief. I had no idea pcc was *that* primitive. They will hit a wall
as hard as carborundum as soon as they try to do decent optimizations.
(Why? Look at the IR. Try to figure out how to rewrite the thing into SSA
form without significant agony. I gave up. And without SSA, you lose, oh,
pretty much all high-level optimizations described in the literature. It's
one reason why GCC was held back for so long... and now another compiler
is blithely heading off down the same wrong track. *sigh*)

pcc seeks contributions to reach 1.0 milestone

Posted Nov 19, 2008 7:34 UTC (Wed) by ragge (guest, #55254) [Link] (7 responses)

Hm, which compiler did you look at? :-) The SSA conversion code has been into pcc for years, I just haven't finished it up, it has not been my main priority.

If you have a compiler with a reasonable internal design, none of the standard optimizing algorithms are especially difficult to add (like SSA conversion, graph-coloring register allocator, strength reduction etc.)

pcc seeks contributions to reach 1.0 milestone

Posted Nov 19, 2008 8:36 UTC (Wed) by nix (subscriber, #2304) [Link]

I think I must be getting it from the wrong place. Never. Do. Research.
While. Ill. *slaps self*

pcc seeks contributions to reach 1.0 milestone

Posted Nov 20, 2008 0:16 UTC (Thu) by bboissin (subscriber, #29506) [Link] (5 responses)

You should really consider having SSA as your primary IR. It makes so many things trivial... I especially like the IR used by libfirm (http://www.info.uni-karlsruhe.de/software/libfirm/index.p... ). It gives you many things for free (SSA all along, no dead code, etc.)

pcc seeks contributions to reach 1.0 milestone

Posted Nov 20, 2008 7:51 UTC (Thu) by nix (subscriber, #2304) [Link] (4 responses)

I'm fairly sure 'having SSA as your primary IR' makes no real sense: it's
like saying 'having assignment as your primary IR'. Having your primary
IR, *whatever it is*, be in SSA form for as much of the time as possible
is probably a very good thing (although I'm not sure how you could convert
*directly* to it: you'd need to go through a non-SSA form immediately
after parsing, and you'd need to go through another one immediately before
conversion to assembler or your output would be ludicrously inefficient).

pcc seeks contributions to reach 1.0 milestone

Posted Nov 20, 2008 16:49 UTC (Thu) by bboissin (subscriber, #29506) [Link] (1 responses)

"you'd need to go through another one immediately before conversion to assembler or your output would be ludicrously inefficient"

Coalescing is done during the Out-of-SSA pass (and it would be very inneficient to do the Out-of-SSA by replacing each phi with a move), if you're in CSSA form, just replace every phi-related variable with a unique variable and that's all (so the hard part is the conversion to CSSA).

As for the IR, I believe SSA can really influence your IR, so it's not just a property (you need parallel moves, etc). Libfirm does that very nicely from what I've seen.

pcc seeks contributions to reach 1.0 milestone

Posted Nov 20, 2008 22:36 UTC (Thu) by nix (subscriber, #2304) [Link]

I only just learned of libfirm from this thread, and it looks *deeply*
cool. I can think of half a dozen potential uses for it already :)

pcc seeks contributions to reach 1.0 milestone

Posted Dec 4, 2008 17:15 UTC (Thu) by salimma (subscriber, #34460) [Link] (1 responses)

LLVM IR is almost entirely in SSA form -- it still has pointers, but apart from that, assignments must be to fresh "registers"

pcc seeks contributions to reach 1.0 milestone

Posted Dec 5, 2008 0:44 UTC (Fri) by nix (subscriber, #2304) [Link]

Oh yes, agreed. I was being pedantic in another area, that it makes no
sense to say that you use SSA *as* your IR, because it's not an IR, just a
set of rules that constrain that IR (it's applicable to many different
sorts of IR, but *you* know that.)


Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds