Slashdot Mirror


GCC Compiler Finally Supplanted by PCC?

Sunnz writes "The leaner, lighter, faster, and most importantly, BSD Licensed, Compiler PCC has been imported into OpenBSD's CVS and NetBSD's pkgsrc. The compiler is based on the original Portable C Compiler by S. C. Johnson, written in the late 70's. Even though much of the compiler has been rewritten, some of the basics still remain. It is currently not bug-free, but it compiles on x86 platform, and work is being done on it to take on GCC's job."

20 of 546 comments (clear)

  1. Kind of depends... by KingSkippus · · Score: 4, Insightful

    ...and most importantly, BSD Licensed...

    Kind of depends on who you ask, doesn't it?

  2. Re:"Nothing for you to see here" indeed... by DiegoBravo · · Score: 3, Insightful

    ...Wake me up when you're able to use PCC instead of GCC to do a 'make bzImage'

  3. Answer by christurkel · · Score: 3, Insightful

    GCC Compiler Finally Supplanted by PCC?

    No. Next question.

    --

    CDE open sourced! https://sourceforge.net/projects/cdesktopenv/
  4. Interesting... by cromar · · Score: 4, Insightful

    I really don't see any point in implementing a new C compiler under the BSD lisence. There's no reason to duplicate effort: it's not like the compiled binaries would be under the GPL. And any GPL libraries you link to, you wouldn't need to distribute (thus avoiding the GPL). So, really, there's no point in duplicating effort on a BSD lisenced compiler. Correct me if I'm wrong.

    1. Re:Interesting... by everphilski · · Score: 4, Insightful

      Principle?

      I don't know, I'm not a BSD user, but as much as RMS likes to claim that 'linux' is GNU/linux, maybe BSD users want their OS to be self reliant?

      Would you like to compile Linux using a microsoft compiler? :)

    2. Re:Interesting... by Anonymous Coward · · Score: 5, Insightful

      Would you like to compile Linux using a microsoft compiler? :) If it produced the best code, why not? People already compile Linux using the Intel compiler.

    3. Re:Interesting... by Brandybuck · · Score: 3, Insightful

      Reason 1) Avoid a monoculture

      Reason 2) Competition

      Reason 3) Choice

      Reason 4) Tweak Stallman's nose

      --
      Don't blame me, I didn't vote for either of them!
    4. Re:Interesting... by Tim+C · · Score: 3, Insightful

      The GNU/Linux thing was kind of retarded given that Linux distributions feature code from a lot of different licenses, and GNU is the only one that's mentioned?

      The justification I've usually seen for that is that GNU is the single biggest "contributor", as it were, particularly with respect to gcc, the command tools, etc. More than just that, though, it could be argued that without GNU, Linux would just be a kernel, with no user space to run. Of course, it could equally be argued that without Linux, the GNU user space tools would just be a nice collection of tools with no OS to run on...

    5. Re:Interesting... by jc42 · · Score: 3, Insightful

      or
      3. they object to the restriction on their freedom?


      or
      4. they like competition and choice, even if the "market leader" is pretty good.

      or
      5. they've learned that a monoculture isn't good for the ecology (even if the "market leader" is pretty good).

      --
      Those who do study history are doomed to stand helplessly by while everyone else repeats it.
    6. Re:Interesting... by Omnifarious · · Score: 4, Insightful

      The real reason that Stallman wants this is that he early on correctly perceived that Linus is totally ideology agnostic, and so he wanted to put the idea of GNU/Linux out there so people would talk about the ideology. I don't think this is bad or anything. I think the ideology needs to be heard more widely.

      It could also be argued that without the GNU project, Linus wouldn't have had a license ready to use for Linux, and I think that contribution by the GNU project weighs at least as much as all the userspace tools which someone would likely have eventually written anyway.

    7. Re:Interesting... by Austerity+Empowers · · Score: 3, Insightful

      But modifying, even forking GCC is practical and rational, whereas making your own, new, compiler and supporting it for all eternity is not. I can understand much of the BSD bent on licenses, but in this case...I don't see it. Compilers are never "done", and writing one with a license that does not ensure other people's updates make it in is just ensuring that the author is perpetually supporting this himself.

      I can understand some applications having closed source licenses...but a compiler is a means, not an end...it really just seems painful.

    8. Re:Interesting... by Anonymous Coward · · Score: 5, Insightful

      I am the GPP, incidentally, and while I'm pleased I got modded up, I certainly wasn't going for funny :). I'm sorry, but C is just a poor choice for ensuring correctness.

      First of all, open up your copy of the C standard (any of them will do) and grep for the phrase "undefined behaviour". C was standardized in a time when everyone and their dog had their own C compiler. Each C compiler did things in a different way, often in contradictory ways. The C standard came along and said "hey, you know what? You're ALL right". I'm being facetious, and the C standard has done a great job in promoting C, but the C standard has really not evolved very far in terms of guaranteeing semantics.

      I don't mean to bring this up to say that "you can't write correct code" in C or such nonsense. Obviously it's easy with good habits (I recommend comp.lang.c as the best place to pick up these habits) to write conforming and well-defined code. But, if you're trying to verify code that's already been written, either by hand or via some automated tool like a static analyzer, it is painful.

      The second problem with C is that it allows a lot of features that make verification of semantics difficult. Pointer aliasing, global variables (even "extern" global variables!!), etc. make static analysis dreadful. If you want to perform static analysis properly on C programs, it's hard to get around whole-program analysis, which is why no one uses static analysis with C code :). Seriously, what does C have beyond lint? How many people even use lint? It's not very useful.

      Of course static analysis is not the end-all be-all of ensuring correct code. There's good coding habits and testing and profiling and whatnot too. But, I would argue that whatever effort can be put into verifying C code can be better put into code in other languages. The semantics of C are sometimes loosely defined, and very often far-reaching, preventing the use of modular reasoning. Whole-program analysis is not your friend.

      What would be really cool is to see from someone like the OpenBSD crowd, if they're so keen on C, develop some verification tools that maybe only work on a very, very restricted subset of C. Any code which does not conform to this restricted "more easily verifiable" subset of C in the core OS would be rejected. I don't know how practical it would be, but it would be cool to see :). I mean as an academic, obviously I think we should all be using Z, but I understand this doesn't make good sense in a lot of real-world projects. But you want to get serious about correctness, don't pussy foot around: get serious about correctness.

    9. Re:Interesting... by Nevyn · · Score: 4, Insightful

      Let's at least get RMS's position right:

      Better idea, let's just get history correct.

      The GNU project was founded in 1984 to create a free operating system.

      Ok, true enough.

      In 1991, they were almost completely finished - they had written every essential component of a Unix-like operating system except for a kernel.

      Sure, and I've almost created a free engery device ... I've done everything apart from this one bit that creates energy for free. Also, GNU did not "create" everything else apart from the kernel ... they created some pieces and were doing the distribution work, so other people "donated" their work.

      Linus came along, wrote the Linux kernel,

      True enough.

      combined it with the almost-complete GNU system, and called the whole thing Linux.

      Not even close to true, Linux has only ever distributed the kernel ... other people combined it and called the whole things like "Red Hat Linux" or "Slackware Linux", GNU should/could have done this but had not bothered to do the work to make a usable distribution (as more than a collection of tarballs) and were happily ignoring Linux and telling everyone else to ignore it and use GNU-Hurd when it would be ready "any time now". This was pretty obvious naming at the time, we didn't call Solaris "GNU/Solaris" when we installed GCC, GNU-tar etc. on it.

      The GNU people were rightly upset that they were getting no credit for their work (to build a complete Unix-like OS).

      They got a huge amount of credit, for the work they did. They just didn't get their name in lights ... because they refused to do the work required for that. Then they complained and wanted more recognition than anyone else got who'd done the same amount of work as they had (like Perl or Xorg etc.) ... this created a "slight" backlash by people who actually know what happened.

      --
      ustr: Managed string API with ave. 44% overhead over strdup(), for 0-20B
  5. Stupid waste of time by th0mas.sixbit.org · · Score: 4, Insightful

    Seriously. Let's duplicate the wheel twice: once for GPL, once for BSD, and then bicker amongst ourselves. Stuff like this stands in the way of actual progress being made. Neither side is right, I don't have a solution, but this is just dumb.

    --
    twitter.com/gravitronic
  6. Re:"Nothing for you to see here" indeed... by MissP · · Score: 3, Insightful

    With respect to

    "The BSD folks would love to have a BSD-licensed drop-in replacement for GCC"

    could somebody provide a reference to verify that "the BSD folks" do in fact have such a desire?

    Thanks!

  7. Re:Increasingly extremeist? by IamTheRealMike · · Score: 3, Insightful

    The reason they look increasingly extremist is because the FSF tends to make up policies and rules which bind GCC development in order to avoid the theoretical risk of making GPL violations easier. As compiler technology advances these restrictions have become increasingly burdensome, in particular, several of the technical advantages of LLVM are things the GCC team would have liked to do but RMS nixed because it would have made it too easy to circumvent the license.

  8. Re:Not for NetBSD for sure by TheRaven64 · · Score: 4, Insightful

    Actually, support for different architectures is one of the main reasons OpenBSD is looking at it. GCC has a habit of dropping architectures because 'nobody uses them,' which causes some OpenBSD (and NetBSD) ports to remain stuck with old versions of GCC. The x86 backend for PCC was written in three weeks by one person, so it seems reasonable to assume it should be possible to add support for the other required platforms relatively easily.

    It's worth remembering that in BSD-land, things are divided into the base system and third party packages. The base system needs a C compiler that is capable of compiling the userland (which PCC already does for OpenBSD), is small, portable, and easy to audit. Packages have quite different requirements; they need support for more languages, etc. PCC is likely to replace GCC in the BSD base systems, but that doesn't mean that people won't install GCC or LLVM for compiling other things.

    --
    I am TheRaven on Soylent News
  9. Re:The licence is just the top of the iceberg by Anonymous+Conrad · · Score: 5, Insightful

    The whole design of GCC is perverted so that someone cannot easily extract a front-end or back-end. This is broken by design, as the GPL people do believe this would make it easier for commercial entities to `steal' a front-end or back-end and attach it to a proprietary code-generator (or language). That's entirely wrong. RMS has been worried about this, and he (through the FSF who own the copyright) have previously objected to any patches that serialize the GCC's intermediate state for just this reason. (Although GCC's new link-time optimization work will change this.)

    GCC's intermediate formats GIMPLE and GENERIC are based on a research compiler, not a deliberate perversion. There's no technical steps to stop reuse, and indeed it has been done - Sun distribute the GCC 4.0.4 front-end altered to use their own SPARC code generator as a back-end.
  10. Re:Does it crash less? by Mr+Z · · Score: 3, Insightful

    while the person you're responding to *is* a troll, I guess it's worth pointing out that GCC and other highly optimizing compilers will "break" some apps that a simpler compiler won't break. Why?

    Many optimizations rely on careful reading of the standard, and explicitly taking the liberties that the standard lets you take. For instance, the following loop terminates on a simple compiler, but becomes infinite on some optimizing compilers:

    int i = 1;

    while (i > 0)
    . . . i = i * 2;

    The ANSI C standard states specifically that signed integer overflow behavior is implementation defined. If you were expecting 'i' to go negative after 30 iterations, and for that to terminate the loop, you could be in for a nasty surprise.

    Suppose an application relied on this behavior, and now it misbehaves when compiled with GCC. Did GCC "break" that application? In some sense, yes: The app functions correctly with compiler (a) but not with compiler (b), so the app must be compiled with compiler (a). The breakage, however, happened because the application its not strictly conforming. It uses compiler dependent semantics, and that's hardly GCC's fault.

    Simpler compilers also don't reorder code as much, and don't optimize away as much "dead code." Stuff that really should have memory barriers, explicit synchronization and perhaps the volatile keyword applied to them run just fine without all those things when compiled with a simple compiler and run on a scalar, in-order CPU. The source code is also easier to read, because in the end the semantics are much more restricted--meaning the compiled output more closely resembles the source input. Give that code to a highly optimizing compiler, though, and run it on a super-scalar, out-of-order machine, and it'll break left, right and center. Is it the compiler's fault? Is it the CPU's fault? It's really the gap between the semantics the programmer thought he had (and happened to have in the simpler environment), and what C actually guarantees.

    Simpler compilers implement simpler semantics that are easier to understand, but only because they're compiling a very restricted form of C that offers way more implicit guarantees than the C standard actually does. Personally, unless that's made explicit (and therefore truly guaranteed forevermore by the compiler), I suspect it's actually a recipe for disaster. If nothing else, it could lead to code that's significantly harder to move to different platforms, since it'll start to rely on these simpler, "easier" semantics. Of course, then again, super-scalar out-of-order CPUs still strip a bunch of that away, so who knows, it might not be that bad.

    --Joe
  11. Pure ISO C99 has limitations when writing a kernel by tepples · · Score: 4, Insightful

    That's not a good test, given that Linux depends on gcc-isms. It's not written in any standardised form of C, which would be a far fairer test. How can a kernel be written in a standardized form of the C language? The C language does not specify any mechanism for alignment, struct packing, code sections, CPU-specific function calling conventions, or any of the various other attributes, nor does it allow for the kinds of inline assembly language needed to talk to the memory mapper or the I/O hardware.