Re: HardBound and SoftBound



Wilco Dijkstra wrote:

"Mayan Moudgill" <mayan@xxxxxxxxxxx> wrote in message news:U5qdnUdy-e-eLhHXnZ2dnUVZ_rWdnZ2d@xxxxxxxxxxxxxx



compiling the following program with gcc 3.4.4 using the command line
gcc -O2 -std=c99
You can also get the same surprising (to you) result on xlc on AIX.


I find this hard to believe, if this is true then it will break a working program
due to instruction scheduling alone. Anyway good luck with it, you need it!

Wilco


It may be difficult to believe, but most (if not all) the so-called "professional" compilers out there actually support gcc's view of ansi aliasing. I know for a fact that IBM's xlc does at optimization level -O2. I double checked and found the relevant flags for HP, Sun and Intel, as well.

I found a very good explanation of possible alias models and the one defined for ISO standard C on:
http://docs.sun.com/app/docs/doc/819-5265/bjaji?a=view
Focus on the implications of using the -xalias_level=std (i.e. the ISO C type based aliasing model).

Now, like I said, I expect that you will get the same interesting behavior from IBM using xlc -O2. You can peruse the xlc online documentation for -qalias or the -qansialias options
For HP: hmmm, it looks like the correct invocation is
acc -Otype_safety=ansi
For Sun, the flags should be -xO3 -xalias_level=std
For Intel's compiler, the flag is probably -O2 -ansi-alias (or /O2 /Qansi-alias on windows systems).

You may need to split the two functions up into two files to inhibit inlining with some of these compilers.

Oh, and try compiling with all optimizations off as well.

.



Relevant Pages

  • Re: xlf vs xlc
    ... I have to compare the running times of C++ programs (compiled with xlC) ... while F77 programs do not use any library calls. ... additional optimizations from xlf, that xlC cannot apply to C++ ... by these two compilers. ...
    (comp.unix.aix)
  • Re: Free UNIX for non-commerical use.
    ... > with UNIX operating systems and compilers. ... > likely use gcc instead and have to accept the poorer performance. ... in your source to keep the vendor compilers from producing invalid code. ... Never got working binaries from any GNU code with xlc and "-O5". ...
    (comp.sys.sgi.admin)
  • Re: Free UNIX for non-commerical use.
    ... > with UNIX operating systems and compilers. ... > likely use gcc instead and have to accept the poorer performance. ... in your source to keep the vendor compilers from producing invalid code. ... Never got working binaries from any GNU code with xlc and "-O5". ...
    (comp.unix.solaris)
  • Re: Free UNIX for non-commerical use.
    ... > with UNIX operating systems and compilers. ... > likely use gcc instead and have to accept the poorer performance. ... in your source to keep the vendor compilers from producing invalid code. ... Never got working binaries from any GNU code with xlc and "-O5". ...
    (comp.sys.hp.hpux)
  • Re: Free UNIX for non-commerical use.
    ... > with UNIX operating systems and compilers. ... > likely use gcc instead and have to accept the poorer performance. ... in your source to keep the vendor compilers from producing invalid code. ... Never got working binaries from any GNU code with xlc and "-O5". ...
    (comp.unix.tru64)