GCC 4.0 Preview
Reducer2001 writes "News.com is running a story previewing GCC 4.0. A quote from the article says, '(included will be) technology to compile programs written in Fortran 95, an updated version of a decades-old programming language still popular for scientific and technical tasks, Henderson said. And software written in the C++ programming language should run faster--"shockingly better" in a few cases.'"
What I'd like to see is features like OpenMP for thread-level parallalism.
Is it just me, or is compiling C++ code an order of magnitude slower than compiling C code? (exaggeration) I'm sure there's a very good reason why this is so, but it still doesn't make me happy.
"You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
"...software written in the C++ programming language should run faster--..."
Is this the programmer's way of saying it will run at some speed less than faster?
But will it compile C++ any faster? The difference between compile times of C and C++ files is staggering. Compiling Qt/KDE takes forever with gcc 3.x.
To think I just got GCC 3.4.3 cross-compiling for my AVR and Coldfire chips, and I get to start all over again.
Progress. I love it!
Have they found some new-fangled magical technique for compilation?
"GCC 4.0 also introduces a security feature called Mudflap, which adds extra features to the compiled program that check for a class of vulnerabilities called buffer overruns, Mitchell said. Mudflap slows a program's performance, so it's expected to be used chiefly in test versions, then switched off for finished products." - from the article
I really love this feature, it will probably cut down on a great deal of problems. My only concern is that some devs will think running it all the time is OK (read: "Mudflap slows a program's performance"), so hopefully that's not the case.
More detailed information on the mudflap system can be found here.
Problems are like gifts, it's better to give than to receive
Screenshots, screenshots! I need screenshots people!!!
Can we get Boost in standard library please ?
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.slashdot.org Errors found while checking this document as HTML5!
And how many times will they break ABI, API and library compatability in THIS major release? Count stands at 4 for the 3 series, maybe higher.
The biggest challenge with Binary compatability across Linux distros is the GCC release (followed by the glibc releases, who live in the same ivory tower). I realize that things have to change, but I wish that they would not break compat between versions quite so often...
I'd really like to be able to take a binary between versions, and it just work.
This is one area where Sun rocks. Any binary from any solaris2 build will just work on any later version. With some libraries, you can go back to the SunOS days (4.1.4, 4.1.3UL, etc). That's 15 years or so.
Zapman
Come on ! Visual C++ has had an IDE for what, twelve years ? and Borland C++ 15 ?
Open source just does not cut it for any serious developer.
I doubt that anyone is going to be rushed to the emergency room for this one.
I'm a signature virus. Please copy me to your signature so I can replicate.
but the reason it takes forever to compile KDE lies in fact that it uses extensively the templates. While templates (a.k.a. generics) are a very useful language feature, they increase compile times. Including support for export template feature could help but only when anybody would use it in their code.
You can make an experiment and try compiling KDE with Intel C++ or Comeau C++ compilers, and see that not much can be gained comparing to GCC.
You can defy gravity... for a short time
I wish the compiler would output sane error messages on compiling code that uses a lot of templates (i.e STL). At least fixing it so that the line numbers are shown during debugging would be a huge improvement!
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
The protection from buffer overruns is valuable enough that perhaps it is worth including all the time. After all, who knows what vulnerabilities lurk after you "turn off" mudflap?
;)
Besides, it might just be automating the addition of the same code that we would need to put in to fix buffer overrun vulnerabilities.
This is one case where I think it's worth "wasting" a small amount of performance (except perhaps in routines that need to be highly optimized) to give added security. Sure beats ray-traced-on-the-fly desktop widgets, or something, which you KNOW we're goingto see advertized in another decade.
Why would you have to use GCC 4.0 for those platforms? I used GCC-3.x for the AVR platform and it did everything I needed... (Which isn't a lot on those machines, I'd say.)
... what's the difference between gcc and g++?
== Jez ==
Do you miss Firefox? Try Pale Moon.
Does anyone have a LiveCD of this stuff? ;-)
echo "getuid(){return 0;}" > e.c; gcc -shared -o e.so e.c; LD_PRELOAD=./e.so sh
My guess is that they are using f2c (translating fortran to C first, then compiling), rather than integrating and updating g77. I don't expect this to match most native Fortran compilers for efficiency.
The gcc team seem to have no respect for legacy code. Incompatible syntax changes and incompatible dynamic libraries make me dread every new release.
If you're interested, here's a (long) discussion which makes reference to many of the things coming in the new GCC.
Game! - Where the stick is mightier than the sword!
A better-established GCC competitor is Intel, whose compilers are recognized to be the gold standard for software running on x86 chips.
Is that actually true? Last time I tried a head-to-head comparison, the Intel compiler came a distant third to GCC and MSVC.
Don't all compilers convert a program's source code into binary instructions?
That GCC is the staple in the embedded world. They could've mentioned that most probably it is the compiler used for the proverbias Internet toaster, or maybe even something sexier, like Formula-1 engine-tuning app... ;-) Apparently the article is written to educate the "general public", would be nice to put this little tidbit into their minds..
Paul B.
$ gcc --version
gcc (GCC) 4.0.0 20050310 (Red Hat 4.0.0-0.33)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I've noticed it compiles a bit faster and the binaries are a bit bigger aswell.
(I'm especially excited by the possibility of random compiler incompatibilities!)
Quote from the article: A start-up called PathScale offers an open-source compiler that's compatible with GCC 3.3. "Our company is trying to be the GCC alternative for people who care about high performance," said Len Rosenthal, vice president of marketing for PathScale..
From this page and their claims about GCC front end (source code) compatibility I infer that their compiler is just an back-end (code generator) to GCC using GCC's front-end. I think that writing full C/C++/Fortran front end with GCC compatibility would be no small feat (especially that most big companies use Edison Design Group front-end, developing only their back-ends).
What looks a little bit suspicious are PathScale's performance claims. It looks like the PathScale compiler for x86 generates much faster code than Intel's own in-house compiler (which is being developed by people hired from KAI known for creating a very high performance compiler) or the industry-famous Portland Group compiler. I would be more than happy to see that PathScale's product delivers what is promised.
You can defy gravity... for a short time
"gcc" will switch languages based on the filename extension. Many people compile C++ by calling "gcc".
"g++" suppresses that bit of logic and forces the language to be C++, which is useful if you have some C code that you want to be built as C++, or if you're feeding the C++ source from stdin (hence, no filename extension).
Linking C++, though, you want to use g++ instead of gcc, unless you really know what you're doing. The "gcc" driver doesn't know which libraries to pull in -- yes, this is something we'd like to change someday -- and the "g++" driver will correctly pull in libstdc++, libm, etc, etc, in the correct order for your linker and your system.
(Hands up, everybody who remembers when "g++" was a shell script!)
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
C++ will be "much faster", so it's now "much slower" than it can be. What about the comparative efficiency of the Java bytecode it will generate? If the Java compiler is already getting more of its maximum theoretical efficiency, doesn't that mean that Java code might be faster than C++? If the Java efficiency isn't as close, doesn't that mean that any comparatively lower performance compared to C++ executables could be overcome by developing the Java compiler further? In fact, doesn't the fact that even C++ compilers as mature as GCC at this late date can get big performance increases with better programming, mean that all the C++/Java performance comparisons are really more about the compiler and its language module optimization?
--
make install -not war
Ada jokes, riiiiight after me !
"And software written in the C++ programming language should run faster--"shockingly better" in a few cases."
What about compilation times?
ajf
It's not a "Have to use..." it's a "Well, will GCC 4.x make my programs fit better in 2048 bytes."
When is GCC going to support the 'export' keyword? You will never be able to claim to fully support ISO C++ until then.
If Fortran 95 was released in '95, and it's now 2005, isn't it a decade old language? Let's not get ahead of ourselves here....
Even the most cursory search of the GCC mailing list archives would disprove this.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
Most Linux distributions and users have the ability to re-compile everything from source, upgrading to the latest GCC is only a day away for me (the time it takes to rebuild my system).
Designing to last is a different issue, and I think there should be less brackages because the software should be designed properly in the first place.
thank God the internet isn't a human right.
What do they do that makes their c compiler so much faster ?
Anyone know when 4.0 will be ready for the distros?
3 monts? 6 months? a year ? forever?
.\.\att Clare
Have you tried maintaining a compiler used in as many situations as GCC? (If not, you should try, before making complaints like this. It's an educational experience.)
We added a "select ABI version" to the C++ front-end in the 3.x series. If you need bug-for-bug compatability, you can have it.
Wanna know when this is gonna happen? Sooner, if you help.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
but does it run linux? oh, wait... nevermind.
But I'm hoping we'll see objective-C++ in this one. And perhaps a nicer solution for C++ template instantiation.
I know how much this looks like trolling ... but Fortran ... why?! After all this time, all the best open source software is written in C. C is the only language I know and the only one I ever will need to contribute to open source ... I don't know of anything written in Fortran.
I know that SSA isn't a new piece of technology, even though it is new to GCC. I'm just wondering what other compilers have been using it, because I don't know. I tried googling for it, but all I could find was information about GCC.
This is an honest question, not a troll.
// file: mice.h
#include "frickin_lasers.h"
You've got to be fucking kidding me.
Have a look at the mailing list anytime somebody reports a bug, and the choice is between fixing the bug and changing the ABI. Watch the flamefests erupt.
(Watch them die down a few days later as one of the brilliant core maintainers manages to do both, with a command-line option to toggle between the default fixed version and the buggy old version.)
Wait a few months. See a new corner-case weird bug some in. Lather, rinse, repeat.
Such as...?
All the ones I can think of were GCC extensions long before they were officially added to the languages. In fact, their presence in GCC actually influences their presence in an official language standard, because that's what the standards bodies do: standardize existing practice.
The troublesome part is when the syntax as added to the language standard differs from the extension that was originally put in GCC. Then we have to choose which once to support -- because supporting both is often not feasible -- knowing that whatever choice we make, slashdot is going to whinge about it. :-)
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
I'm glad Mudflap is going to be built-in, but I think it's moronic to turn it off for finished products. Given a choice between safety from buffer overflows and a 5% speed-up, which would you choose for most of your software (desktop and server)? It's pretty obvious to me. I wouldn't even notice a speed difference of even 10% or 20% on most applications, but I sure would notice a buffer overflow that lets all my data get swiped.
Why is a trivial performance gain more important than safety? I'll never understand this type of thought, but that seems to be how a lot of developers think.
i remember using a 'vectorizing' fortran compiler on a convex "mini super" in 1988. It had vector units and in those days such hardware with automatically vectorizing fortran compilers was quite common.
I think convex even added vectorizing to its C compiler at the time.
Hands up, everybody who remembers when "g++" was a shell script!
...
Are you going to rob us? At first I thought that was your joke, but the more I think about it, the more I wonder if, being a part of the gcc team, you are inserting insidious code to look for credit card and bank account numbers on the disk during compiles and use steganography to embed them in executables; no one else would know about them, and all you'd need is a robot crawling download pages, looking for binaries with some magic code somewhere
The little bit of extra disk thrashing during the combined compile and search would never be noticed, and no one looking at compiled machine lanuage ever wonders why it is so odd looking. They just assume it's because of some new fangled optimization.
My god you are devious rascals!
Infuriate left and right
GCC is an incredibly versatile compiler, with frontends for C, C++, Java, Ada and Fortran provided with the basic install. 3rd party extensions include (but are probably not limited to) Pascal, D, PL/I(!!) and I'm pretty sure there are Cobol frontends, too.
They did drop CHILL (a telecoms language) which might have been useful, now that telecoms are taking Linux and Open Source very seriously. As nobody seems to have picked it up, dusted it off, and forward-ported it to modern GCCs, I think it's a safe bet that even those interested in computer arcana are terribly interested in CHILL.
OpenMP as been discussed on and off for ages, but another poster here has implied that design and development is underway. OpenMP is a hybrid parallel architecture, mixing compiler optimizations and libraries, but I'm not completely convinced by the approach. There are just too many ways to build parallel systems and therefore too many unknowns for a static compile to work well in the general case.
Finally, the sheer size and complexity of GCC makes bugs almost inevitable. It provides some bounds checking (via mudflap), and there are other validation and testing suites. It might be worth doing a thorough audit of GCC at this point, so that the 4.x series can concentrate on improvements and refinements.
It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
I think I've seen a compiler that compiled to BF code... or maybe it was the other way around. heh. :)
I'm eagerly awaiting 4.0 so functional language compilers (like GHC for Haskell) which spit out C code will be able to take advantage of the benefits of SSA (Single Static Assignment)
A question... for what reasons mainly do you find vim more suitable for programming than say, emacs? I've recently become used to emacs for my C++ stuff, but I'm wondering whether to switch to vim at the cost of having to remaster the kb bindings.
I have programs for 2.95 that won't even run under 3.x ... any chance of having backwards compatibility?
At the GCC conference in Ottawa in the summer of 2003, there were two very interesting features presented that they said might make it into GCC 4.0.
- LLVM. Low Level Virtual Machine. This is a low level and generic pseudo code generator and virtual machine.
http://llvm.cs.uiuc.edu/
This sounded fabulous, and the project appears to be progressing well (it's at v1.4 now). If I understand correctly it is only politics that has kept it out of GCC 4. Can anyone shed more light on this?
- Compiler Server. Rather than invoking GCC for each TU you would run the GCC-Server once for the whole app and then feed it the TU's. This would make the compile process much faster and allow for whole program optimization.
This would have been nice but perhaps they found better ways to achieve the same thing.
At present, there are numerous features of Fortran 95 that gfortran (the gcc Fortran 95 compiler) does not handle correctly. G95 http://www.g95.org/, from which gfortran forked, is closer to being a full Fortran compiler. One can search the Usenet group comp.lang.fortran to confirm these statements.
If you just want a free Fortran 95 compiler use g95. Bugs reported to Andy Vaught are usually fixed quickly, and fresh Linux compiler binaries are posted almost daily. If you want to participate in the development of a Fortran 95 compiler, gfortran is more democratic.
If you have source, binary compatibility isn't such a big deal.
Not sure what you tried but in most compiler benchmarks Intel ranges from "just as fast as the others" to "devistatingly faster". It sometimes generates code that's faster than hand optimised assembly designed to do the same thing. The Intel compiler even generates better code for Athlons than other compilers.
It gets even more devistating on Fortran. Seems Intel has like the only good Fortran compiler in the world. That's part of the reason their chips do so well on SPEC, the FP part is all fortran code and their compiler just rules at it.
If you Google around for compiler benchmarks you'll find a number of them, and virtually all show the Intel compiler dominating. One of the best, which I can't find a link for right now, was a test done by Toms Hardware. They did MPEG-4 encoding with the P4 and found that it blew. Intel figured something was wrong, got the source and recompiled the program (was compiled with VC++ 6.0). The P4 almost quadrupled in speed (and got even faster with the SSE optimised modes they added), and even the Athlons showed a near doubling in speed.
"They that can give up high performance to obtain a little temporary security deserve neither performance nor security."
--not Benjamin Franklin
My other first post is car post.
do parellel compiles across multiple systems. Most geeks own at least several systems (normally quite a few more). There are plenty of good parellizing tools.
I prefer the "u" in honour as it seems to be missing these days.
That's a good URL, but the post is buried in 0-point-ness. Moderators, some love here, please?
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
...would that not mean the speed other programs run at reaches "faster" more quickly?
"There is more worth loving than we have strength to love." - Brian Jay Stanley
AutoConf isn't part of GCC. The only alternative to autoconf that I know of is PMK.
Does anybody know how much of the C++ standard is implemented in gcc 4.0, especiallly regarding templates and the STL? Until now, what I have heard, the Microsoft compiler was the most up-to-date C++ compiler around. Did gcc 4.0 catch up?
C++ memory management has a form of "GC" which is usually done via reference counting, auto_ptr's, etc.
;)
If this is not used, and memory is completely manualy managed for performance reasons, it is no longer "good C++". With today's algorithms, requires O(n) to allocate (n being a function of the available memory count or hole count, depends on the scheme) and O(n) or O(1) to free (in the case of O(1), allocation is typically inefficient.
With good generational GC, you can get O(1) allocation, O(1)-amortized freeing (O(n) memory restructuring once "every n free calls"). The downsides are an extra dereference on every ptr, but this can be overcome with smart paging tricks and/or "safe" zones where GC won't be called (the dereference only has to occur once in those).
In theory, there is no reason for explicit memory management to be slower than any form of GC, but in practice (of existing methods), manual memory management is actually of far worse performance than good GC. Unfortunatly, this is also true of GC, which is also implemented in a very unideal way.
Anyhow, in conventional C++, every ptr assignment requires increasing/decreasing a refcount, which is more expensive than periodic mark and sweep under some scenarios of cache locality.
Its way too complex to compare GC to non-GC in theory as they are affected by too many factors. All existing implementations of both GC and malloc/free are highly inefficient, so benchmarks are also moot.
Maybe in 20 years we'll reach a concrete conclusion on that one
Gcc was what killed fortran. Gcc did not implement many fortran features forcing fortran programmers to use a pathetic subset of the language. For example in F77 they never implemented opening files read only (only open read-write) so you could never detect EOF's on pipes to fortran 77. But the real death knell for fortran was sung by g95 and its reduced language elements. Anyone who mistook g95 for F95 would indeed be right in concluding fortran was a dated useless language. Fortran95 does indeed have stucrtures, classes, pointers and allocatable memory contrary to widespread belief to the contrary due to g95. The irony is that fortan 2000 is actually a wonderful language for scientific programming in the coming age of multi-core processors. I would not write a wordprocessor in fortran but for sceintific programming its effieicient memory storage, implicit parallelism in the most basic elementes of the language language (for example for-loops that were allowed to iterate over their range out of order, and subroutines that declare which variables can have side effect) is perfect for the coming age of microprocessing. My favorite parts of fortrans are that one cannot overflow a buffer nor is it possible for a typo to compile. That last statment will elude understanding by most folks who never tried to write a line parser for fortran syntax but it's consequence is that hidden syntax errors that compile are impossible in fortran. (logic errors of course are possible in any language) one trivial example is you cant write = when you meant == or +=. Or the declaration of intent on calling arguments allows you to pass by reference without worrying that an array will be unintentionally modified. RIP fortran95, killed by g95.
Some drink at the fountain of knowledge. Others just gargle.
The fact that almost all Unix C/C++ software requires something like autoconf or imake says everything about the software development environment, doesn't it? IMHO it stinks like rotten eggs from the 60's.
They always either break the scripts for making cross-compilers or something will break with glibc. Or it will break with uClibc. Or it'll require a specific version of binutils, or some other problem.
My other first post is car post.
in 1990. Yeah, I remember early g++.
I prefer the "u" in honour as it seems to be missing these days.
Apropos compiler incompatibilities: do the new GNU compilers still add funny things like useless trailing underscores for non-C routines by default? And how about Fortran character strings, are they still passed with a hidden argument for the length in addition to the formally declared argument (address) or have the GNU people by now figured out why, for example, VMS compilers use a descriptor (structure) to describe complex arguments?
Working for a company that makes engine tuning products (Diablosport) I can say we sure do use GCC for quite a few of our products. Several different versions, but no 4.0 yet.
Yes. Compile-time errors now introduce an electric shock through the keyboard and mouse.
Apparently, the key to quick compile times is ellimiting the hackers who need to compile more than once to get it compiled.
Looks like it's begrudging compliance with GPL.
Speaking of literal compliance ... I've seen that this new gcc has a new back-end and that it's unlikely that anyone will actually get the front end of the ada part of gcc to talk to it. Anyone want to say how long it will be until someone can do a relatively straight install of gcc (linux and mingw) and have C, C++, and Ada all in and working and producing compatible object code?
Amen. My company moved to C++ from fortran just for that reason. It's almost like the way microsoft killed java by creating a buggyreduced implementation of it as the defacto standard.
do you really not recognize a phrase intended for the portion of the audience that doesn't know what a compiler is?
The construction "a compiler, which does foo" defines compiler, while "a compiler that does foo" implies that foo is specific to this compiler. There's a difference. If that's grammar national socialism, then Sieg Heil!
Morons like myself that don't code for a living can no longer understand WTF is going on with the code, so we can't get our hands dirty and screw things up.
Next step, shaving the center of my head and molding the sides into nice little pointy things. The transition has begun.
Are his defenders going to justify it this time? Now we get to lose out on a good technology because it doesn't fit into Stallman's world view. That's fascist.
It seems the move from 3 to 4 happened much faster than the move from 2 to 3.
Coder's Stone: The programming language quick ref for iPad
OS X 10.2 shipped with GCC 3.1 I believe -- a while before it was released.
;-)
10.3 shipped with GCC 3.3, before 3.3 was released.
10.4 looks to continue the pattern. Apple takes a snapshot of GCC, forks it 6-9 months before the OS ships, tweaks/tunes/optimizes GCC, builds and ships with that version of the compiler, and then re-submits its changes, so future GCC builds (especially the PPC ones) get all the goodies.
And the compiler has had 6-9 months of QA from Apple, which is as good as the amount of credit you give their QA department
That they leave in the -std=c89 flag. I'm supporting a big system from a company that invented non-compatible versions of the c99 math library functions a little bit ahead of time.
(invented in the early 90's)
Doesn't that mean (not available for use in free software until the early 10's)?
Delivering VB with an IDE and a bunch of libraries is what turned the... thing?... into a huge success. GCC, the developpers behind it, and the developpers who use it deserve more than silly statements such as this one.
And GCC-4.0 too?
open4free ©
what are the differences/advantages of gfortran over g95?
700MB of RAM usage and 78 minutes of compile time (on a 2.2GHz A64). But boy was that code optimized!
*grin*
Can Eclipse be one?
There is a spark in every single flame bait point.
The only way to make you happy would be to build in a slow-down to the C compiler (which would make the kernel folks -- amongst others) a bit sadder.
Engineering is the art of compromise.
Is there anyone who knows what this LLVM issue is about? Anyone out there who is not just ranting incoherently about RMS?
Peace, or Not?
The most important thing about GCC 4.0 is that
it is an enabler for all kind of interesting things in the future.
The Tree-SSA infrastructure add a very solid base that
allows future optimizations to be written much easier than before.
For example there are 50+ NEW optimization passes
(not all unique) that are now run at the tree level.
Optimization passes are MUCH easier to run at the tree
level as there's more high level information available, and it
does not require detailed knowledge of the target machine.
You will see more an more optimizations added to GCC.
Another thing that 4.0 will allow is easier integration
of new front-ends for other languages. Now the front-ends
are better separated from the rest of the compiler.
There are things that still need work, for example
some aspects of alias analysis is not as good at the tree level as it
is at the lower RTL level.
So expect even more improvements in 4.x, x>0
Come on people:
sizeof(int)
In the 3.x series of GCC, the output for C language programs has degraded somewhat in terms of execution time and size, while the performance of C++ language programs has improved somewhat.
I hope this apparent tradeoff doesn't go a step further in the 4.x series, as most of my work is still done in C.
For me (floating-point intensive C programs on a P4), ICC and GCC's performances are usually very close, unless autovectorization works for the most time-consuming loops (which is rarely the case in my program) or when a lot of sin/cos/exp functions are called (ICC has a very well optimized SSE-based math library which GCC lacks). Other differences in instruction scheduling, register allocation, inlining, etc. usually have significant effects only in very specific cases.
LLVM is sort of a mostly-compiled form of a program.
(like preprocessed, but more work having been done)
If gcc can convert C to LLVM, and LLVM to native,
then you could replace either half with something
proprietary. You could add a proprietary middle
step that optimized LLVM code.
Just thought I would point out that Phil is one of the people who have been in charge of the libstdc++ (GNU Standard C++ Library) for a long time. I realise that no one is used to actual subject authorities on slashdot.
[RIAA] says its concern is artists. That's true, in just the sense that a cattle rancher is concerned about its cattle.
It's a pretty far-fetched idea, but...
LLVM can be used as a GPL bypass. If this were to
become a problem, people would not feel as good
about contributing to gcc.
Well, that's how RMS thinks anyway. Never mind that
adding LLVM would enable some really neat stuff.
I'm waiting for the WYRMWYW (What You Really Meant When You Wrote) technology to be incorporated into GCC, so it will fix all my bugs as it compiles. Then I'll upgrade.
LLVM is written in C++, and RMS has dictated "Only C shalt thou write for gcc."
Dilbert: (watching C++ program compile) "Do you realize what this means??"
Wally: "Hey! You're getting paid to do that!"
wow, it's unbelievable.
There is a spark in every single flame bait point.
If C++ will run "shockingly better" that necessarily means it was shockingly bad to start with. It's like when Microsoft came out with FAT32 and claimed it would give you more usable space...but didn't go into the details of how they'd been pissing away your space before. "Yeah, we suck less!" Where's that eye-roll punctuation mark when I need it?
Slashdot - News for Herds. Stuff that Splatters.
is a for loop inside a printf statement :)
..etc ..etc ..etc .. etc
and why can't they add ADA inside C?
we should have a way of declare function as
ADA funka(...)
C++ funkb(...)
JAVA func(...)
COBOL fund(...)
If your memory is that constrained, you should not be using C.
Considering what it's doing (making software compile and run on different hardware, OS, and lib variations), using configure isn't that bad. most cases you can do. Creating these monstrosities, that's the not so fun part.
If you're comparing to MS tools, remember you're targetting a single system. That has it's own plusses and minusses. And if you think MS stuff always rules, I remeber doing driver work on Win32 and Win98 and I needed 3 seperate compilers (1.52 for the 16 bit thunk DLL, 4.0 for the VxD, and 5.0 for application code). Tools suck usually, they're generally best when they get out of the way as easily as possible.
Sorry, but I this compile server idea is a dog. Distcc is less error prone, far simpler and works even when preprocessor tricks are used. Your compile server makes a lot of assumptions that many popular projects break. Getting an "optimal" compile time is not practical nor is it useful. Sometimes the 90% solution (distcc) is the best solution.
Found via Google... http://strawberry.resnet.mtu.edu/pub/gcc/gcc/snaps hots/4.0-20050109/
Paleotechnologist and connoisseur of pretty shiny things.
And it's absolutely horrible for any kind of C++ development. Look at Boost's C++ regression test suite results for gcc on Darwin - they are discraceful! The fact that they are branching in the middle of Stage 1 or early in Stage 2 has meant that they have a compiler that's about as bad as the infamous RedHat 2.96 series, only Apple, Inc puts out bugfixes even more rarely.
Its so bad, that I don't even use Apple's GCC for any C++ development; I always start by building a GCC/G++ from FSF's released codebase.
WTF offtopic?
"Play is the only way the highest intelligence of humankind can unfold." -- Joseph Chilton Pearce
I want to know whether the Fortran 95 code will compile and/or run faster than C++ using GCC 4.0 :-)
Truly pathetic moderation.
I disagree.
I can compile useful robot-control programs in C that fit in 208 bytes of program space using "C"
It controls two variable-speed DC motors and follows a black line on the floor.
That ain't too shabby for C
You should try compiling for something other than a Microsoft platform someday!
printf("%d\n", ({for(i=2;i14;i++);i;}) );
is SCons.
Maybe 99.999% of the world will disagree with me but I advocate breaking almost every program on earth.
I'd like gcc to flag as an *error* any pointer/int casting on all platforms. And believe me, as an amd64 user I guarantee you almost every program out there does this. It may be legal C and it may work OK on X86 but as soon as you move to an LP64 platform (basically every 64-bit platform) you will get burned.
We need to force the programs out there to get 64-bit clean in the first place. We shouldn't have to react to it after the fact.
That's what inspired me.
Infuriate left and right
First they ignore you, then they laugh at you, then they fight you, then you win.
please check out the Dice animated gif that comes with the article (you might have to reload to see it, as they might have changing adverts
.. tossers
if(threshold = salary_sucks)
= ?? on a GCC article ??
And that company claims to be high-tech ?
Sheesh
Many modern filesystems use something called delayed allocation, so (eg, temp) files that are written and deleted shortly after, are removed from the write queue, and never actually make it to disk. I think I recall reading it coming to reiserfs a few years back. So the effect is that /tmp already is mounted in ram.
-2A
The revolution will not be televised... but it will have a page on Wikipedia
And RAM is cheap. Go buy some more of it.
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
OK, I did read the LOTD for a while, but it didn't waste any significant time compared to Usenet. After all, by the time Dilbert came out, it wasn't possible to read all of Usenet any more, even by printing it out 4-up double sided on the gimongous Xerox printer in the basement. (Though by about the time we had that printer, it was possible to use the mainframe in the basement to do compiles on, running some ersatz Unix version on Amdahls at a blazing 10 MIPS, with far more RAM and I/O horsepower than our Vaxen had...)
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
You should read "The Pragmatic Programmer"? One of their tips is "Don't live with broken windows" (bad designs, wrong decisions, or poor code). When some part of your software is broken/bad it is easy to get into the mindset that all of the surrounding code is just as crappy.
Look it up on Google, there are lots of websites discussing this.
What I want to know is, when are they going to support the latest version of C? The standard's been out what, 5 or 6 years? It's the primary language of the compiler. And yet I still can't pass complex numbers to functions and expect it to work. Please, someone get C99 support working.
I am trolling
Would LLVM let me write a BF backend for GCC? That would be so leet.
I am trolling
Writing safe code in C is easy - you just have to sit down and do it, and not get lazy. C++ has some more convenient tools for writing safe code, but C is really just fine. The real problem is that both of them let you write unsafe code, so a random chunk of C++ from some careless slacker is just as dangerous as a random chunk of C code. C++ was useful precisely because it retained relatively good backwards compatibility with C, which means you can still shoot yourself in the foot with the same precision, simplicity, and beauty that you always could, as well as introducing newer and more baroque ways to do it.
Some of my friends rave about Python, or about Objective-C; I haven't tried them enough to comment usefully. There are still a few problems which benefit from down-to-the-virtual-metal programming - device drivers and occasional numerical hackery - but most of the real performance problems aren't language overhead, they're environmental baggage or memory bloat or overuse of ill-matched packages. The obsolete laptop I'm typing on right now has a CPU 1500 times faster than the ones I learned to program C on, with about 1000 times as much RAM. The machines I learned to do graphics on mostly had about 10 MIPS and 8 MB of RAM. Some of the bloating is an economic tradeoff - programmers are still expensive, while hardware just isn't (the desktop sitting next to me costs 1/1000 of what my first VAX cost, with 2500 times the CPU and 150 times the RAM - I'm using it to download music.) Wasting a bit of CPU horsepower to check boundaries decently is definitely cheaper than wasting user time debugging or cleaning up viruses.
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
I'm really tired of seeing Linux releases coming out saying "You have to build the kernel with GCC version x.y.z and Gnome/KDE with version x.w.q and be sure to only build GlibC using GCC version x.f.m." Scary-looking stuff - how much code do people write that should be significantly different for different compiler versions?
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
A very annoying bug for us VIA C3 users was that GCC uses the CMOV instruction with i686, even though CMOV is an optional instruction according to Intel specs. This prevented software compiled for i686 to run on VIA C3 processors.
Does anyone know if this GCC bug is fixed in the development version or in the upcoming 4.0?
cpghost at Cordula's Web.
I'd much rather see a compiler that is half as fast but generates twice as fast code. I really can wait another 4 hours to have the desktop manager compiled and then have it running fast, smoothly, making the experience pleasant, than to have crap compiled now.
Anagram("United States of America") == "Dine out, taste a Mac, fries"
Long awaited significant improvement on symbols visibility. Saves RAM, saves disk, and as a consequence, allows to save link and load time. -- "La simplicité fait l'élégance"
Love salty crackers? catchy electronica? Try !
GCC is the staple of the entire OSS/GNU/Linux world. While it's possible to run alternate compilers on Linux and some people do, the majority of OSS is compiled on GCC for the same reason the majority of OSS is written on Linux - it's free, it's available, and it works well.
It doesn't much matter if the Intel compiler can out perform GCC on x86 because people will continue to use GCC.
I can only see GCC getting better and better over time.
- It's not the Macs I hate. It's Digg users. -
It says that UNIX and C are flexible enough to support multiple hardware platforms? Yeah, what a bummer that is!
idlake, I want you to know how much I have appreciated your comments in this thread. MOD PARENT idlake UP, EVERYWHERE.
It's "they that can give up runtime safety to obtain a little boost in performance..."
You said, "... it introduces lots of extra management hassles for larger projects--you have to be constantly alert that developers don't start using unsafe or dangerous constructs."
idlake, you seem to know far more about this than I. Isn't what you said indicative of a social problem? Are programmer employees so uncooperative that they cannot be trained?
I hit a key accidentally, and Firefox clicked the Submit button for me. Here's what I intended to say: You said, "... it introduces lots of extra management hassles for larger projects--you have to be constantly alert that developers don't start using unsafe or dangerous constructs."
idlake, you seem to know far more about this than I. Isn't what you said indicative of a social problem? Are programmer employees so uncooperative that they cannot be trained?
It seems to me that a lot of the problems with C++ could be solved simply by not using all the features.
There is a similar problem with human languages. If someone insisted on using a selection from most of the 550,000 English words, he or she would make himself incomprehensible.
Amazing how a site like CNET can take an interesting story and mangle it to look like a regurgitated press release. Their authors must spend years honing this particular stilted style.
-- Ed Avis ed@membled.com
Slashdot inserted a space in the URL. Don't miss to remove it...
for example
mkfifo mypipe
write to the pipe:
perl -we 'open FH, "mypipe"; @s =`ls`; print FH @s;close FH'
in another terminal, run your program and the perl script that feeds text to the pipe, and try reading mypipe to the end. It will hang because g77 opens the pipe read-write and thus the pipe senses that there is an alternate writing device to the pipe and thus no EOF gets generated when the perl script closes the pipe.
oops, dang slashdot filters! there should be the greater-than sign in front of mypipe in the perl file open:
perl -we 'open FH, ">mypipe"; @s =`ls`; print FH @s;close FH'
Why does that GNU mascot look like he's sucking his thumb?
Is it just me?????????
I think the point is that g95 in fact does not implement the standard. meaning people have to use a reduced feature set if they want to distribute their code, just like Microsoft did with java. as for excuse of g95 being in beta, well 1995 is a bit of a long time ago, and its been years since the g95 project started. its starting to rival dukeNukem's next release date.
as for excuse of g95 being in beta, well 1995 is a bit of a long time ago, and its been years since the g95 project started. its starting to rival dukeNukem's next release date.
What an absurd remark. What is to stop people from using a commercial compiler? And looking at the g95 web page, I see that the project started in 2000. When you remember that it has been an essentially one-man effort, five years for a compiler sounds pretty good to me. Why are you fixated on 1995? The Fortran 95 standard wasn't released until 1997. Do you know anything about what you are talking about?
Tubal-Cain smokes the white owl.
When will GCC include support for COBOL?
Slow down, cowboy! It has been 4 hours since you last posted. You must wait another few hours.
Thanks, but you kinda missed the point. At least you were a bit closer than the other people who replied.
I know you can have make be silent. I know you can log its output. I know you can split its stdout from its stderr. I know all that. There's a reason I mentioned a GUI.
Most of this sort of thing is already done, at least to some extent, in GUI IDEs like kdevelop. The thing is, sometimes you don't want, or can't easily use a full IDE. For instance, when compiling a kernel, the makefiles and procedures are already in place for you. You don't want to create a new project, you just want to build the kernel. On the other hand, if something blows up while you're compiling the kernel, you want to know, and you don't want information overload.
I don't think you can do what I want with existing make / GCC options. I really think to do it right you'd need a wrapper. You could pipe the output of make/gcc to the wrapper, and then it could format the output all pretty-like.
That's what Emacs is for!
... so the use of other language inside gcc is not forbidden as such.
Martin.
I didn't go into details because this has been covered elsewhere, and I'm tired of discussing it myself. But I didn't realize I would be accused of "uninformed slander". So. A bit of background info first.
Inside the guts of the compiler, after the parser is done working over the syntax (for whatever language), what's left over is an internal representation, or IR. This is what all the optimizers look at, rearrange, throw out, add to, spin, fold, and mutilate.
(Up to 4.0, there was really only one thing in GCC that could be properly called an IR. Now, like most other nontrivial compilers, there's more than one. It doesn't change the political situation; any of them could play the part of "the IR" here.)
Once the optimizers are done transforming your impeccable code into something unrecognizable, the chip-specific backends change the IR into assembly code. (Or whatever they've been designed to produce.)
Each of these transformations throws away information. What started out as a smart array class with bounds checking becomes a simple user-defined aggregate, which becomes a series of sequential memory references, which eventually all get turned into PEEK and POKE operations. (Rename for your processor as appropriate, or look up that old joke about syntactic sugar.)
Now -- leaving out all the details -- it would be Really Really Useful if we could look at the PEEKs and POKEs of more than one .o at a time. Since the compiler only sees one .c/.cpp/.whatever at a time, it can only optimize one .o at a time. Unfortunately, typically the only program that sees The Big Picture is the linker, when it pulls together all the .o's. Some linkers can do some basic optimization, most of them are pretty stupid, but all of them are limited by the amount of information present in the .o files... which is nothing more than PEEK and POKE.
As you can imagine, trying to examine a pattern of PEEK and POKE and working out "oh, this started off as a smart array class with bounds checking, let's see how it's used across the entire program" is essentially impossible.
Okay, end of backstory.
The solution to all this is to not throw out all that useful abstract information. Instead of, or in addition to, writing out assembly code or machine code, we write out the IR instead. (Either to specialized ".ir" files, or maybe some kind of accumulating database, etc, etc; the SGI compiler actually writes out .o files containing its IR instead of machine code, so that the whole process is transparent to the user.) Later on, when the linker runs, it can see the IR of the entire program and do the same optimizations that the compiler did / would have done, but on a larger scale.
This is more or less what all whole-program optimizers do, including LLVM. (I think LLVM has the linker actually calling back into the compiler.)
The "problem" is that between the compiler running and the linker running, the IR is just sitting on the disk. Other tools could do whatever they want with it. RMS's fear is that a company would write a proprietary non-GPL tool to do all kinds of neat stuff to the IR before the linker sees it again. Since no GPL'ed compiler/linker pieces are involved, the proprietary tool never has to be given to the community. Company wins, community loses.
End of problem description. Begin personal opinionating.
It's a legitimate concern, but many of us feel that a) it's going to happen eventually, and b) we do all GCC users a disservice by crippling the tools merely to postpone an inevitable scenario. As usual, there's a wide range of opinions among the maintainers, but the general consensus is that keeping things the way they are is an untenable position.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
I've explained it in a sibling post just now. I was hoping to encourage people to go look up the discussions themselves, but if it's easier to accuse me of slander, so be it.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
+3 Informative
Exactly what features of the standard is it that you claim g95 doesn't implement? As editor of the f95 and f2003 standards, I have some interest in the question. I don't claim to have done exhaustive testing, but it looks like a pretty complete implementation to me as far as I have seen. Not 100% bug free, but then neither is anything; I'd say it has advanced into the state of being usable. It runs my f95 code, which heavily uses features new to f90.
Are you confusing g95 with gfortran? Though they forked from the same base, their current status is quite different (gfortran doesn't yet run my codes). Or are you talking about an old version of g95? I'd say that it made some pretty major leaps just a few months ago.
If you really mean the current version of g95, I would seriously like to know specifics of what these allegedly missing features are. I'm not just flaming. It would be useful information that I would actually like to know.
yes, not everyone configures gcc is for use in native compile mode...
Wasn't meant to be a joke... I know they build GCC with GCC, but I don't suppose they could have built the front-end with GCC 4.0 yet, due to the bugs still present. So current speed up is probably based on compilation with GCC 3.4.
Don't know why I bother writing this, none's going to read it now...
1's and 0's should be free.
I think a lot of the rants here are historical ones. The issue for many developer was that g95 was not feature complete till sometime in late 2004. Basic things like say data structures were missing for years. The absence of a free or cheap f95 compiler meant anyone who wanted to ship source code cold only do so if the client was willing to buy a pro-compiler. People left the f95 party. Hopefully the same thing wont happen with f03.
Did you just call OCaml "mainstream"?
I think some sort of major development in OCaml history just occurred here.
And if you are using templates, you are actually using a compile time language, which obviously will slow compilation down.
But they do claim C++ compilation is much faster with 4.0:
Personally, I don't care much. Development seem to be restricted by link time, for a well organized project. And I always compile with full optimization.How is this offtopic? It isn't GCC per se, but it's withing the realm of shortening compile times. Certainly germane to the discussion.
WTF is the matter with the mods?
"Play is the only way the highest intelligence of humankind can unfold." -- Joseph Chilton Pearce
Still, the rant is wrong in the sense that it blames an early development version to be not yet complete.
The rant would be valid if it said that the *absense* of (a released) G95 was bad for Fortran, but I can't see much truth in a rant which claims that G95 hurt Fortran because it was feature incomplete.
Marcel
Would the world have been better off if MS had not messed with Javascript and Java, shipping broken versions that became the default? I suspect it would have been better not to have a weak g95 than to have had none at all till it was feature complete.
I think it would have been highly naive for someone to develop fotran programs specifically for those early, unstable and incomplete versions of G95 and Gfortran.
I think both G95 and Gfortran projects are doing exactly what you are asking for. The wait with the official release until they are good enough from the completeness and stability point of view.
Your analogy with MS and Java is completely wrong as MS actually *shipped* their Java version with IE. This is *not* the case with G95 and Gfortran.
Marcel
When you cross-compile, building on a 32-bit arch and targetting a 16-bit arch, sizeof(int) will return 2. (or 1, if your compiler uses a 16-bit char) You will not get a 4 unless your compiler is emulating a 32-bit int for the 16-bit machine.
As far as binary struct layout goes, yeah, that is undefined. In general though, there is no problem if you use <inttypes.h> (for int32_t and such) and you naturally align all data elements with explicit padding. The real world uses only two types of endianness, which you'll also need to deal with.