comp.lang.ada
 help / color / mirror / Atom feed
* A SPARC curiosity.
@ 1997-10-29  0:00 W. Wesley Groleau x4923
  1997-10-29  0:00 ` Robert S. White
  1997-10-29  0:00 ` Stephen Leake
  0 siblings, 2 replies; 4+ messages in thread
From: W. Wesley Groleau x4923 @ 1997-10-29  0:00 UTC (permalink / raw)



I received some SPARC-specific C code with embedded asm() from 
someone at Sun.  It had a lot of printf.  I trimmed the output down
to the subset I needed, and it still worked.  I then changed it to
put the output into an Ada string, changed the while loop to
a for loop, and had the Ada do the printing.  It didn't work. 
 
But as I was trying to figure out what seemed wrong, I discovered 
it DOES work on another SPARC!

Details:
gcc 2.7.2 and gnat 3.10 crossmounted to both machines.
Same executable (no relinking) does not work on this:
   166 -> uname -a
   SunOS sparc02 5.5.1 Generic sun4d sparc SUNW,SPARCserver-1000
but does work on this:
   169 -> uname -a
   SunOS gc058 5.5.1 Generic sun4u sparc SUNW,Ultra-2

The error is not a crash or other disaster, merely a truncation of
the output.  Optimization -O3 and -O0 are the same.

Anyone with a little time and a lot of curiosity want to look at it?

-- 
----------------------------------------------------------------------
    Wes Groleau, Hughes Defense Communications, Fort Wayne, IN USA
Senior Software Engineer - AFATDS                  Tool-smith Wanna-be
                    wwgrol AT pseserv3.fw.hac.com

Don't send advertisements to this domain unless asked!  All disk space
on fw.hac.com hosts belongs to either Hughes Defense Communications or 
the United States government.  Using email to store YOUR advertising 
on them is trespassing!
----------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A SPARC curiosity.
  1997-10-29  0:00 A SPARC curiosity W. Wesley Groleau x4923
  1997-10-29  0:00 ` Robert S. White
@ 1997-10-29  0:00 ` Stephen Leake
  1997-10-30  0:00   ` W. Wesley Groleau x4923
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Leake @ 1997-10-29  0:00 UTC (permalink / raw)



W. Wesley Groleau x4923 wrote:
> 
> I received some SPARC-specific C code with embedded asm() from
> someone at Sun.  It had a lot of printf.  I trimmed the output down
> to the subset I needed, and it still worked.  I then changed it to
> put the output into an Ada string, changed the while loop to
> a for loop, and had the Ada do the printing.  It didn't work.
> 
> But as I was trying to figure out what seemed wrong, I discovered
> it DOES work on another SPARC!
> 
> Details:
> gcc 2.7.2 and gnat 3.10 crossmounted to both machines.
> Same executable (no relinking) does not work on this:
>    166 -> uname -a
>    SunOS sparc02 5.5.1 Generic sun4d sparc SUNW,SPARCserver-1000
> but does work on this:
>    169 -> uname -a
>    SunOS gc058 5.5.1 Generic sun4u sparc SUNW,Ultra-2
> 
> The error is not a crash or other disaster, merely a truncation of
> the output.  Optimization -O3 and -O0 are the same.

Does the C code behave the same on the two machines? They seem to have
slightly different versions of the OS. If GNAT is calling the C library
for low-level output, a difference in the two libraries would explain
things. Hmm, that assumes the libraries are dynamically linked; does
SunOS on SPARC do that?
-- 
- Stephe




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A SPARC curiosity.
  1997-10-29  0:00 A SPARC curiosity W. Wesley Groleau x4923
@ 1997-10-29  0:00 ` Robert S. White
  1997-10-29  0:00 ` Stephen Leake
  1 sibling, 0 replies; 4+ messages in thread
From: Robert S. White @ 1997-10-29  0:00 UTC (permalink / raw)



In article <345741D3.2162@pseserv3.fw.hac.com>, wwgrol@pseserv3.fw.hac.com 
says...

>But as I was trying to figure out what seemed wrong, I discovered 
>it DOES work on another SPARC!
>
>Details:
>gcc 2.7.2 and gnat 3.10 crossmounted to both machines.
>Same executable (no relinking) does not work on this:
>   166 -> uname -a
>   SunOS sparc02 5.5.1 Generic sun4d sparc SUNW,SPARCserver-1000
                                    ^                 ^^^^^^
>but does work on this:
>   169 -> uname -a
>   SunOS gc058 5.5.1 Generic sun4u sparc SUNW,Ultra-2
>
>The error is not a crash or other disaster, merely a truncation of
>the output.  Optimization -O3 and -O0 are the same.

  Couple of possiblities.  Is one machine a multi-CPU and the other
a uniprocessor?  I was told by one of our UNIX admins at work that
Solaris 2.5 (which you have above) requires a full working day to
install all of the patches after upgrading a SPARC workstation from
an older SunOS or Solaris 2.4 os.  Could the problem machine be
missing one of these patches?  We will be hoping that Solaris 2.6
does not require as many patches.
 
  Have you tried posting this to comp.sys.sun.misc or 
comp.unix.solaris ?

_____________________________________________________________________
Robert S. White         -- An embedded systems software engineer
e-mail reply to reverse of: ia us lib cedar-rapids crpl shift2 whiter





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A SPARC curiosity.
  1997-10-29  0:00 ` Stephen Leake
@ 1997-10-30  0:00   ` W. Wesley Groleau x4923
  0 siblings, 0 replies; 4+ messages in thread
From: W. Wesley Groleau x4923 @ 1997-10-30  0:00 UTC (permalink / raw)



> W. Wesley Groleau x4923 wrote:
> > [ C code which changes its behavior on another CPU without 
> > re-linking ]

> Stephen Leake wrote:
> 
> Does the C code behave the same on the two machines? They seem to have
> slightly different versions of the OS. If GNAT is calling the C library
> for low-level output, a difference in the two libraries would explain
> things. Hmm, that assumes the libraries are dynamically linked; does
> SunOS on SPARC do that?

That's the whole point.  The C code doesn't.  To be a little more
clear, the code is a non-destructive stack unwind, with a check to
jump out when the stack gets outside of the main program.  With ONE
link, it works right on SunOS 5.5.1 on a SPARC workstation but
the same executable file under SunOS 5.5.1 on a SPARC server,
exits after reading only the first stack address (and the second
stack address, by the way, is in the same C file as the first one).

SunOS and Solaris allow dynamic linking, but that is not the issue
here.  By the way, since C's portability was recently discussed
in this newsgroup, someone else tried my code on SunOS 4.1.3.
Even though we were both using gcc 2.7.2, he had to make significant
changes just to get it to compile.  But as soon as it did compile
(with no changes to the Ada part), it worked!

-- 
----------------------------------------------------------------------
    Wes Groleau, Hughes Defense Communications, Fort Wayne, IN USA
Senior Software Engineer - AFATDS                  Tool-smith Wanna-be
                    wwgrol AT pseserv3.fw.hac.com

Don't send advertisements to this domain unless asked!  All disk space
on fw.hac.com hosts belongs to either Hughes Defense Communications or 
the United States government.  Using email to store YOUR advertising 
on them is trespassing!
----------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1997-10-30  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-29  0:00 A SPARC curiosity W. Wesley Groleau x4923
1997-10-29  0:00 ` Robert S. White
1997-10-29  0:00 ` Stephen Leake
1997-10-30  0:00   ` W. Wesley Groleau x4923

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox