Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

CC /POINTER_SIZE=64=ARGV, Alpha, NULL termination of argv[]?

 
Jeffrey Goodwin
Frequent Advisor

Re: CC /POINTER_SIZE=64=ARGV, Alpha, NULL termination of argv[]?

The problem was on IA64 at one time:

IA64 Dec C compiler for OpenVMS: Includes fix for problem related to specifying /POINTER_SIZE=LONG=ARGV, the argv argument to main, which comprised of long pointers, was not terminated with NULL.

This problem has been corrected HP-I64VMS-C-V0703-019ECO1-1

I would seem the problem was the same root issue. I didn't see a matching Alpha patch.

-Jeff
WW304289
Frequent Advisor

Re: CC /POINTER_SIZE=64=ARGV, Alpha, NULL termination of argv[]?

"
For all I know, there's
some POSIX standard (or something) which
demands that argv[] be NULL-terminated [...]
"

It is in the C standard. From ISO/IEC 9899:201x

5.1.2.2.1 Program startup

1 The function called at program startup is named main. The implementation declares no
prototype for this function. It shall be defined with a return type of int and with no
parameters:

int main(void) { /* ... */ }

or with two parameters (referred to here as argc and argv, though any names may be
used, as they are local to the function in which they are declared):

int main(int argc, char *argv[]) { /* ... */ }

or equivalent;9) or in some other implementation-defined manner.

2 If they are declared, the parameters to the main function shall obey the following
constraints:

â The value of argc shall be nonnegative.

â argv[argc] shall be a null pointer.
Dennis Handly
Acclaimed Contributor

Re: CC /POINTER_SIZE=64=ARGV, Alpha, NULL termination of argv[]?

>on Alpha with 64-bit pointers, it breaks down. In that case, these programs frequently see one extra garbage argument on their command lines

Have you tried printing that address? Perhaps only 32 bits is zero?
Steven Schweda
Honored Contributor

Re: CC /POINTER_SIZE=64=ARGV, Alpha, NULL termination of argv[]?

> Have you tried printing that address?

Have you tried reading this thread?


> Perhaps only 32 bits is zero?

We're little-endian here, so values like:

> [...] ptr: %x000000007adcd870 [...]
(Mar 8, 2011 04:15:28 GMT)

or:

> [...] (got 7FF57810)
(Mar 8, 2011 21:22:47 GMT)

aren't even zero at the beginning (the
low-significance end).

But thanks for playing.
Highlighted
Robert Brooks_1
Honored Contributor

Re: CC /POINTER_SIZE=64=ARGV, Alpha, NULL termination of argv[]?

This problem has been corrected HP-I64VMS-C-V0703-019ECO1-1

I would seem the problem was the same root issue. I didn't see a matching Alpha patch.

---

I've seen some internal-to-HP communication on this one, and apparently VMS Engineering states that an Alpha patch is in the works.
I have no idea when it's due to hit the streets.

-- Rob
Steven Schweda
Honored Contributor

Re: CC /POINTER_SIZE=64=ARGV, Alpha, NULL termination of argv[]?

> This problem has been corrected
> HP-I64VMS-C-V0703-019ECO1-1

Hey. Sure enough. That's so old that even
_I_ have it:

IT $ cc /version
HP C V7.3-019 on OpenVMS IA64 V8.3-1H1

which explains why I saw the problem only on
Alpha (V7.3-009).

I probably read the ".txt" file when I
downloaded the patch, but figured that I'd
never care, and promptly forgot all about it.
(It's not my fault. This 64-bit pointer
stuff was all someone else's idea. I may
still never care for my own purposes.)

> [...] an Alpha patch is in the works.
> I have no idea when it's due to hit the
> streets.

That's nice to know, but, of course, a lowly
hobbyist peon like me may never see it, as I
can no longer gain access to those streets.
Dennis Handly
Acclaimed Contributor

Re: CC /POINTER_SIZE=64=ARGV, Alpha, NULL termination of argv[]?

>Have you tried reading this thread?

Oops, sorry I missed that.
It would have helped if you printed them as increasing:
"argv[%d] = ptr: %p, %s\n", i, &argv[i], argv[i]

>aren't even zero at the beginning (the low-significance end).

Yes.