fixunix
Tags Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

HP aCC 6.1 IO Stream issue - HP UX

This is a discussion on HP aCC 6.1 IO Stream issue - HP UX ; Hi, Apologies in advance if this is in the wrong group. I'm having a problem with the HP-UX C++ compiler aCC 6.1.3. I have a file compiled into an object file thats used in linking a binary. The file thats ...


Fix Unix > Unix > HP UX > HP aCC 6.1 IO Stream issue

Reply
 
LinkBack Tools
  #1  
Old 10-07-2007, 03:29 PM
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default HP aCC 6.1 IO Stream issue

Hi,

Apologies in advance if this is in the wrong group.

I'm having a problem with the HP-UX C++ compiler aCC 6.1.3.

I have a file compiled into an object file thats used in linking a
binary. The file thats linked contains a block of memory defined as:

static unsigned char x[36] =
{
0x00, 0x01, ..
};

When the binary is built the block of memory is not placed into the
binary. I've opened the binary with a hex editor and its simply not
there. Everything is compiled with the -AP flag (classic IOStream).
Now if I turn optimisation off then it is added in there. The thing
is that the block of memory is read by a different program, so its not
referenced as far as optimisation goes, and so it's removed.

Now the strange thing is if I recompile everything using the -AA
(standard IOStream), the memory block is there and the exact same
optimisation options are present.

Of course I can get around this optimisation issue with -AP, by
defining x as being non-static and referencing it in the binary with
"extern unsigned char x[];" But I shouldn't have to.

Is there a major difference between the optimisation done for both
flags? I can't seem to find anything relevant, either from the
compilers documentation or anywhere on the net about this.

If anyone has any comments I'd love to hear them.

Cheers,

--Keith

Reply With Quote
  #2  
Old 10-07-2007, 03:29 PM
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: HP aCC 6.1 IO Stream issue

Keith Halligan writes:

> static unsigned char x[36] = { 0x00, 0x01, .. };
>
> When the binary is built the block of memory is not placed into the
> binary.


Valid optimization assuming 'x' isn't referenced.

> Now the strange thing is if I recompile everything using the -AA
> (standard IOStream), the memory block is there and the exact same
> optimisation options are present.


It is generally futile to ask "why did or didn't this version of
this compiler with these flags perform that valid optimization" --
the answer will likely change with a minor patch, and you can't do
anything with the "why" anyway.

> Of course I can get around this optimisation issue with -AP, by
> defining x as being non-static and referencing it in the binary with
> "extern unsigned char x[];"


You can keep it static, but you must reference it somehow.

Since you know what you need to do, just do it -- the next version
of your compiler, or a different compiler when you switch to it,
will still keep 'x' if it is referenced.

> But I shouldn't have to.


Why not? It is legal for the compiler to optimize out unreferenced
code and data. You must preserve that data for some reason compiler
can't see, therefore you *should* do what's necessary to prevent
that optimization.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Reply With Quote
Reply

Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Is it possible to play an audio stream to an endpoint that already has an audio stream established? unix Programmer 0 10-04-2007 06:39 PM
TCP Stream in Win XP Pro? unix Networking 3 10-01-2007 06:02 PM
Performace issue using Stream Interface Driver unix Windows CE 3 10-01-2007 01:42 PM
help with stream directives unix Veritas Net Backup 0 04-02-2006 09:45 PM
Error: Access denied to directory - Error reading security data stream. Exchange issue? unix Veritas Backup Exec 1 04-14-2003 01:09 AM


All times are GMT. The time now is 10:47 AM.