GLucas compile works on gcc-3.3.2 SFW, but not with studio 11.
I am trying to optimize the following program:
glucas-2.9.2-20060416 available at:
http://www.oxixares.com/pub/glucas/snapshots/
I have this path set for the GCC compile:
/sbin:/bin:/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/dt/bin:/usr/openwin/bin:/usr/j2 se/jre/bin:/usr/j2se/bin:/usr/xpg4/bin:/usr/vmsys/bin:/usr/snadm/bin:/var/adm/sm .bin:/usr/oasys/bin:/usr/lib/lp/bin:/platform/sun4u/sbin:/usr/platform/sun4u/sbi n:/usr/sadm/sysadm/bin:/usr/sadm/install/bin:/usr/sadm/bin:/usr/sadm/admin/bin:/ usr/proc/bin:/usr/apache/tomcat/bin:/usr/apache/bin:/opt/SUNWspro/bin:/opt/SUNWs pro/lib/bin:/opt/SUNWspro/prod/bin:/opt/SUNWspro/contrib/vim/bin:/opt/SUNWspro/c ontrib/xemacs-21.4.12/bin:/opt/SUNWrtvc/bin:/opt/netbeans/3.5V11/modules/bin:/op t/netbeans/3.5V11/bin:/usr/ucb:/opt/SUNWspro/sfw/bin:/opt/sfw/sparc-sun-solaris2 .9/bin:/opt/sfw/gcc-3/bin:/usr/sfw/sbin:/usr/sfw/esp/bin:/usr/sfw/bin:/opt/sfw/s bin:/opt/sfw/netpbm/bin:/opt/sfw/esp/bin:/opt/sfw/bin:/usr/local/sbin:/usr/local /bin
I have this path set for the "Studio ONLY" compile:
/sbin:/bin:/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/dt/bin:/usr/openwin/bin:/usr/j2 se/jre/bin:/usr/j2se/bin:/usr/xpg4/bin:/usr/vmsys/bin:/usr/snadm/bin:/var/adm/sm .bin:/usr/oasys/bin:/usr/lib/lp/bin:/platform/sun4u/sbin:/usr/platform/sun4u/sbi n:/usr/sadm/sysadm/bin:/usr/sadm/install/bin:/usr/sadm/bin:/usr/sadm/admin/bin:/ usr/proc/bin:/usr/apache/tomcat/bin:/usr/apache/bin:/opt/SUNWspro/bin:/opt/SUNWs pro/lib/bin:/opt/SUNWspro/prod/bin:/opt/SUNWspro/contrib/vim/bin:/opt/SUNWspro/c ontrib/xemacs-21.4.12/bin:/opt/SUNWrtvc/bin:/opt/netbeans/3.5V11/modules/bin:/op t/netbeans/3.5V11/bin:/usr/ucb
The program compiles in both environments. On the top, GCC is found and used, 3.3.2, provided by the companion CD. The program, Glucas, compiles and passes the self tests.
The program is compiled in the second environment and does complete the make process (without errors) and it does run without a segfault, however, the self tests fails.
I was wondering if anyone had ever encountered an application that compiles (without errors) and runs perfectly on GCC but when Studio 11 is used something clearly goes wrong.
Done on an SPARC IIi 400/2MB with Solaris 9 u8 + all patches for both OS and Studio 11.
[2307 byte] By [
mickrussom] at [2007-11-26 8:53:46]

# 2
Some possibilities:
1. The code has undefined behavior that works only by accident using one compiler. Maxim pointed to such an example.
2. The code has implementation-dependent behavior that is valid for one compiler but not another. Example, where foo and bar are functions: [code]foo( bar(2), bar(3) ); [/code]
If function bar has side effects, program behavior depends on whether bar(2) or bar(3) is called first. One compiler might guarantee left-to-right evaluation of function parameters, but most compilers do not. Other examples are the effect of some operations involving negative integers, and the behavior of floating-point calculations.
3. The Open Source code self-configures for a set of compilers that does not include Sun compilers. Conditional code (#ifdef) winds up with critical pieces missing. If you are unlucky, the code compiles and links, but does not run correctly.
4. The code triggers a bug in the Sun C compiler.
I suggest you look first at #3.
If the problem does not seem to be due to configuration issues, compile with -g and run the program under dbx and try to find where it is going wrong.
If there is a community support email alias or discussion group for this application, you should also try there. Someone else might have already discovered a fix.
# 3
> I am trying to optimize the following program:
>
> glucas-2.9.2-20060416 available at:
>
> http://www.oxixares.com/pub/glucas/snapshots/
Did you ever have any success with this?
I'm keen to try a compile for Solaris on AMD64 to run on and X4600 to see if it outperforms the 16way Itanium machine they currently do the new prime check/refutation on.
# 4
Hi
> /sbin
You don't need this.
> /usr/sbin
Or this.
> /usr/j2se/jre/bin:/usr/j2se/bin
Do you need both?
> /usr/vmsys/bin
I doubt very much that you need this
> /usr/snadm/bin
Solstice admin? Do you need that?
>/var/adm/sm.bin
This is empty on this Sol8 SPARC system.
> /usr/oasys/bin
As per vmsys
> /usr/lib/lp/bin
Printer admin?
> /platform/sun4u/sbin
> /usr/platform/sun4u/sbin
> /usr/sadm/sysadm/bin
> /usr/sadm/install/bin
> /usr/sadm/bin
> /usr/sadm/admin/bin
These are all contain admin tools.
> /usr/proc/bin
These apps are useful, but already all in /usr/bin
> /usr/apache/tomcat/bin
> /usr/apache/bin
I guess that you need these.
> /opt/SUNWspro/bin
And you need this.
> /opt/SUNWspro/lib/bin
> /opt/SUNWspro/prod/bin
> /opt/SUNWspro/contrib/vim/bin
> /opt/SUNWspro/contrib/xemacs-21.4.12/bin
> /opt/SUNWrtc/bin
> /opt/netbeans/3.5V11/modules/bin
> /opt/netbeans/3.5V11/bin
All of the apps that you need, generally, are in /opt/SUNWspro/bin
> /usr/ucb
Good - in last place.
> The program is compiled in the second environment and
> does complete the make process (without errors) and
> it does run without a segfault, however, the self
> tests fails.
>
> I was wondering if anyone had ever encountered an
> application that compiles (without errors) and runs
> perfectly on GCC but when Studio 11 is used something
> clearly goes wrong.
Of course this is possible. If the code contains any "#if defined(_GNU_C)"s (or whatever) that are necessary for the code to work, then it's quite possible for Studio to compile the code, but for it to fail.
Paul