Live data from Hacker News

Extracting the abstract syntax tree from GCC

lwn.net

81–90 of 112 posts

Re: Extracting the abstract syntax tree from GCC

#81

Its hard for me to come up with a way in which this is not RMS advocating restricting the freedom of users of GCC. If he is so opposed to proprietary software using GCC output why not use a license that prohibits that? Its not even too late for new versions since the FSF owns the copyright to all GCC code.

That's the great irony of the copyleft movement -- it's about restricting what people can do under the guise of "freedom". RMS doesn't want people to "misuse" his software, but his version of misuse is "use it for a purpose that doesn't advance GNU." He's willing to cripple his software so that some theoretical entity that doesn't actually exist and does not agree with his politics can't misuse it. On a practical lev…

> That's the great irony of the copyleft movement -- it's about restricting what people can do under the guise of "freedom".

This is extremely misleading: Copyleft is about making sure everyone has the same rights.

> Basically what I'm trying to say is that RMS is a nutcase.

And here you prove you have no serious argument, by devolving to insults.

Re: Extracting the abstract syntax tree from GCC

#82

Its hard for me to come up with a way in which this is not RMS advocating restricting the freedom of users of GCC. If he is so opposed to proprietary software using GCC output why not use a license that prohibits that? Its not even too late for new versions since the FSF owns the copyright to all GCC code.

That's the great irony of the copyleft movement -- it's about restricting what people can do under the guise of "freedom". RMS doesn't want people to "misuse" his software, but his version of misuse is "use it for a purpose that doesn't advance GNU." He's willing to cripple his software so that some theoretical entity that doesn't actually exist and does not agree with his politics can't misuse it. On a practical lev…

Depends on how define "freedom".

I should have the "freedom" to block off my street at night, because the traffic keeps me awake. But dang society (and laws) don't let me do that! Clearly, my "freedom" is being impinged by others! Right?

/s

Re: Extracting the abstract syntax tree from GCC

#83
post #81

Earlier quoted context omitted.

That's the great irony of the copyleft movement -- it's about restricting what people can do under the guise of "freedom". RMS doesn't want people to "misuse" his software, but his version of misuse is "use it for a purpose that doesn't advance GNU." He's willing to cripple his software so that some theoretical entity that doesn't actually exist and does not agree with his politics can't misuse it. On a practical lev…

> That's the great irony of the copyleft movement -- it's about restricting what people can do under the guise of "freedom". This is extremely misleading: Copyleft is about making sure everyone has the same rights. > Basically what I'm trying to say is that RMS is a nutcase. And here you prove you have no serious argument, by devolving to insults.

As the steward of both GCC and GNU Emacs, the question of whether RMS is a "nutcase" is apropos.

Many of us who know him well would not object to the essential meaning of that word, even if we don't ourselves use it.

Re: Extracting the abstract syntax tree from GCC

#84

Earlier quoted context omitted.

That's the great irony of the copyleft movement -- it's about restricting what people can do under the guise of "freedom". RMS doesn't want people to "misuse" his software, but his version of misuse is "use it for a purpose that doesn't advance GNU." He's willing to cripple his software so that some theoretical entity that doesn't actually exist and does not agree with his politics can't misuse it. On a practical lev…

Depends on how define "freedom". I should have the "freedom" to block off my street at night, because the traffic keeps me awake. But dang society (and laws) don't let me do that! Clearly, my "freedom" is being impinged by others! Right? /s

Thing is, society gives you several options to deal with the real problem short of enclosing a public commons:

Don't move into such a place.

If it becomes such a place, leave (it'll be more valuable, so you should be able to make a profit if an owner, or pay less in rent).

If it's people illicitly making too much noise, sic the authorities on them (although now in the US I'd hesitate to do that unless the situation is life and death, and often even not then).

Re: Extracting the abstract syntax tree from GCC

#85

Earlier quoted context omitted.

That's the great irony of the copyleft movement -- it's about restricting what people can do under the guise of "freedom". RMS doesn't want people to "misuse" his software, but his version of misuse is "use it for a purpose that doesn't advance GNU." He's willing to cripple his software so that some theoretical entity that doesn't actually exist and does not agree with his politics can't misuse it. On a practical lev…

Depends on how define "freedom". I should have the "freedom" to block off my street at night, because the traffic keeps me awake. But dang society (and laws) don't let me do that! Clearly, my "freedom" is being impinged by others! Right? /s

That's not really a correct analogy though.

If I take a piece of software and keep my changes to myself, it would be fair to say that I'm antisocial and selfish, but overall I have not negatively impacted anything -- I've simply refused to reciprocate the benefit I've received. That makes me a jerk, but objectively nothing bad has happened. Whereas if you were to block off your street, you're actively depriving people of a service, etc.

In this case RMS is actively refusing a feature that would be a boon for many people, because he want's to make sure it doesn't help people he dislikes. IMO, that's on the same level of companies obfuscating file formats so people can't build off their products. That's not defending freedom, it's just being a prick.

Re: Extracting the abstract syntax tree from GCC

#86

This is precisely what we do in Renjin in order to translate C/Fortran to Java: https://github.com/bedatadriven/renjin/blob/master/tools/gcc... This little plugin simply dumps GCC's gimple to JSON, yielding for example: https://github.com/bedatadriven/renjin/blob/master/tools/gcc... LLVM's design looks very attractive, but for scientific computing Fortran is really important, and AFAICT, LLVM doesn't have an intermed…

> LLVM doesn't have an intermediate representation comparable to Gimple: LLIR seems to be at the level of the registers rather than the nice abstract Gimple LLVM variables are sometimes called registers but they are machine independent. The bit width is arbitrary (e.g., you can create a 129-bit integer). The use of the term register is a misleading analogy; often LLVM-IR is compared to assembly language so the use of…

Will have to take another look, but it still sounds to me like LLVM IR is more comparable to RTL (https://gcc.gnu.org/onlinedocs/gccint/RTL.html#RTL).

Gimple variables have types comparable with C types - you get pointers, arrays.

For example:

  int sum10(int values[10]) {
    int i;
    int sum = 0;
    for(i=0;i
is compiled down to:

  sum10 (int * values)
  {
    long unsigned int D.1598;
    long unsigned int D.1599;
    int * D.1600;
    int D.1601;
    int D.1602;
    int i;
    int sum;

    sum = 0;
    i = 0;
    goto ;
    :
    D.1598 = (long unsigned int) i;
    D.1599 = D.1598 * 4;
    D.1600 = values + D.1599;
    D.1601 = *D.1600;
    sum = D.1601 + sum;
    i = i + 1;
    :
    if (i ; else goto ;
    :
    *values = 342;
    D.1602 = sum;
    return D.1602;
  }

Re: Extracting the abstract syntax tree from GCC

#87
post #17

Earlier quoted context omitted.

And the absolute certainty that without getting buy-in from RMS, the API would be constantly changed to frustrate such a AST dumping API. Unless GCC and/or EMACS (using LLVM) gets forked. Again.

True, but it takes effort to change the API, and even if they did something obfuscatory to it automatically with every new version, it wouldn't be all that hard to write something that parses GCC's source code or compiles programs specifically designed to exercise the right paths - and grabs the right bits automatically; a meta-AST-extractor. Similar techniques are already in use for automatically generating wrapper…

The only counter I have to "it wouldn't be all that hard to..." statements is that it is 2015, emacs can't even refactor things like xcode can do. And xcode is considered horrible by refactoring standards.

If it were so easy it would have happened by now. One can only conclude gcc and its stewardship have no real desire to allow for such a thing to occur at all.

Which means llvm will likely be the future for being able to handle large complex code bases and interactivity with editors like emacs or vim, or whatever else. Why we have to reparse c/c++ in every editor alive when the compiler already does such things and would just need to dump out the information needed to understand it is beyond me.

I only see 2 solutions to this situation. First is gcc gets left behind as a backwater compiler that won't interact with the real world due to religious reasons. Second is it gets forked and like ecgs before it, the fork becomes the canonical version (likely ignored by the gnu/fsf folks as being a heathen fork or whatever).

Re: Extracting the abstract syntax tree from GCC

#88
post #87

Earlier quoted context omitted.

True, but it takes effort to change the API, and even if they did something obfuscatory to it automatically with every new version, it wouldn't be all that hard to write something that parses GCC's source code or compiles programs specifically designed to exercise the right paths - and grabs the right bits automatically; a meta-AST-extractor. Similar techniques are already in use for automatically generating wrapper…

The only counter I have to "it wouldn't be all that hard to..." statements is that it is 2015, emacs can't even refactor things like xcode can do. And xcode is considered horrible by refactoring standards. If it were so easy it would have happened by now. One can only conclude gcc and its stewardship have no real desire to allow for such a thing to occur at all. Which means llvm will likely be the future for being ab…

And GNU Emacs has to fork, absent getting RMS's buy-in, which is now not the way to bet. That's where the serious fork has to occur, I presume it could get by with LLVM output, right? Which of course would not be ideal if you're using GCC in your project....

Oh, if only they'd ignore the heathen fork of one of their marque projects. Not going to happen with EMACS, 99+% of its greatness is due to RMS by universal acclimation as of the very early '80s.

Re: Extracting the abstract syntax tree from GCC

#89
post #81

Earlier quoted context omitted.

That's the great irony of the copyleft movement -- it's about restricting what people can do under the guise of "freedom". RMS doesn't want people to "misuse" his software, but his version of misuse is "use it for a purpose that doesn't advance GNU." He's willing to cripple his software so that some theoretical entity that doesn't actually exist and does not agree with his politics can't misuse it. On a practical lev…

> That's the great irony of the copyleft movement -- it's about restricting what people can do under the guise of "freedom". This is extremely misleading: Copyleft is about making sure everyone has the same rights. > Basically what I'm trying to say is that RMS is a nutcase. And here you prove you have no serious argument, by devolving to insults.

> This is extremely misleading: Copyleft is about making sure everyone has the same rights.

In theory... except in this case, the point is ensuring that people who don't share his political leanings can't use the product in a way he doesn't like (to generate an AST). It's not even about modifying gcc in this context, he doesn't want people to "misuse" it. It's entirely about telling people what they can and can't do with their software. Where is the freedom in that?

> And here you prove you have no serious argument, by devolving to insults.

I'm calling him a nutcase because he's being paranoid by crippling his own software to prevent a thing that people can already easily do with a competitor (clang). It's not like people are like "oh no gcc can't emit an AST I guess I'll give up and forget the entire venture" they just go "well I guess I'll go use clang instead"

Re: Extracting the abstract syntax tree from GCC

#90
post #68
post #52

Earlier quoted context omitted.

The most free world is not the one where there are the fewest restrictions. Restricting peoples' natural freedom to kill each other or steal from each other, for example, arguably makes everyone more free. The GPL is based on the same principle. Restricting certain antisocial behavior increases net freedom.

" natural freedom to kill each other " Although that's not a binary thing, I have the natural and legal right to kill in legitimate self-defense. In rare situations, stealing is allowed to prevent a greater loss. In this case, most of us, even those of us who don't like the GPL in practice like me, are not primarily arguing the GPL, but RMS's stewardship of GCC and GNU Emacs about something that's allowed in I believ…

> In this case, most of us, even those of us who don't like the GPL in practice like me, are not primarily arguing the GPL

However, people are making the argument that this proves that GPLparticularly strange for people to take the position that RMS's behaviour here is anti-freedom and thus obnoxious, and therefore GPL sucks. It shouldn't be necessary to point out that he could pull the same stunt just as easily if GCC were under a BSD license. In fact he could achieve the same effect even more easily, because he wouldn't have to rely solely on constantly changing the AST interface, or the threat of doing that: he could put future official versions of GCC under a new license which tried to put up legal barriers to AST access, or threaten to do so. More broadly, it's hard to imagine any consistent position under which RMS attempting to exert some de facto proprietary control over GCC is tyrannical, but licenses which would have given him the authority to make future official GCC versions de jure completely or semi-proprietary are upholding freedom! Of course, you can argue that RMS' behaviour here proves that he is being hypocritical when he denounces others for exercising proprietary control of software, through proprietary works derived from FOSS software or by other means. But just as obviously, catching someone in hypocrisy doesn't necessarily mean that they were wrong.

Moreover, it needs to be addressed not only because people are drawing incorrect conclusions about GPL vs. BSD, but because it shows that they don't understand what's going on here. The problem here isn't licensing terms, it's Too Big To Fork https://news.ycombinator.com/item?id=6810259 . "Freedom of the press is guaranteed only to those who own one." Speaking of which, it's strange. Here RMS is using his position to exert some de facto proprietary control over GCC, a big, hard-to-replace hairball of code with lots of clients locked in to its interface, and widespread anger is (quite appopriately) the result. Yet the Web browser vendors have honed this kind of behaviour into a routine, regularly exerting their de facto power over the Web, and sometimes in nakedly self-serving and destructive ways, and people have been conditioned to hail and venerate this as the Open Web.

Post reply on HN