1828220 Members
2201 Online
109975 Solutions
New Discussion

C compiler warning

 
Nivel
Frequent Advisor

C compiler warning

I am trying to clear C compiler warnings. For the attached program extract (a function StringsToArray, used to place a variable number of strings into an array), 3 compiler warnings are issued for each line:
str = (char *)va_arg(pvar,char *)
The warnings are all the same "Casting from loose to strict alignment".
When ANSI migration warnings are asked for instead, a different warning for the same lines is issued "Large unsuffixed integer constant will be type unsigned integer in ANSI-C".
Can anyone help?
11 REPLIES 11
Steven Schweda
Honored Contributor

Re: C compiler warning

HP-UX, C compiler versions?
Actual compiler command(s)?
Dennis Handly
Acclaimed Contributor

Re: C compiler warning

>3 compiler warnings are issued for each line: str = va_arg(pvar,char*)
>"Casting from loose to strict alignment".

I only see one per line.

>When ANSI migration warnings are asked for instead, "Large unsuffixed integer constant will be type unsigned integer in ANSI-C".

These are known problems in , even on 11.31:
JAGag11411: Warning 706 when using varargs.h +M0
JAGae16638: Warnings 530 on va_arg using varargs.h

I don't see any patches for this header.
I do see it incorrectly listed on:
PHSS_36092 PHSS_36089 PHSS_36086 PHSS_28706

You can of course just edit your copy of . :-)

>Steven: C compiler versions?

These are PA header file problems with .
Nivel
Frequent Advisor

Re: C compiler warning

Compiler: HP C/HP UX Version B.11.11.16
Compiler command:
cc +w1 -DSYSV -Aa -D_HPUX_SOURCE -DXOPEN_CATALOG -DXT_CODE

Included NOT
Steven Schweda
Honored Contributor

Re: C compiler warning

> HP-UX, C compiler versions?

> Compiler: HP C/HP UX Version B.11.11.16

That's a start. Should I need to guess the
HP-UX version (and hardware architecture), or
did you think that I knew enough to infer it
from the compiler version? (Ha!)
Torsten.
Acclaimed Contributor

Re: C compiler warning

I would guess its 11.11 and PA-RISC because of this ...


;-))

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Dennis Handly
Acclaimed Contributor

Re: C compiler warning

>HP C/HP UX Version B.11.11.16
>Included NOT

Yes but is just a wrapper around .

>Steven: Should I need to guess the HP-UX version

No need. ALL PA versions are broken.
But you have a very valid point, answers to both questions should be supplied, even though redundant in this case.

>did you think that I knew enough to infer it
from the compiler version?

Yes, it is encoded. And anyone who can answer Nev's question would know this. :-)
Nivel
Frequent Advisor

Re: C compiler warning

Thanks Dennis.
HP-UX version is 11i v1 (11.11i)
Workstation is C8000 (PA-RISC)
Interesting that the warnings I have seen (530 and 706) are the two that you have indicated occur because of the known problems with varargs.h
Dennis Handly
Acclaimed Contributor

Re: C compiler warning

>Interesting that the warnings I have seen (530 and 706) are the two that you have indicated occur because of the known problems with varargs.h.

Why should be interesting? If you never supply a patch, it will never be fixed for customers.
Nivel
Frequent Advisor

Re: C compiler warning

I have installed patch PHSS_36086 (the only one relevant to my compiler / HP UX version). The warnings as described in my original post are still issued.
Any more ideas?
Thanks in advance.
Dennis Handly
Acclaimed Contributor

Re: C compiler warning

>I have installed patch PHSS_36086

I have already said that the patch document is incorrect, it doesn't fix the problem because it doesn't supply .

>>I don't see any patches for this header.
>>I do see it incorrectly listed on:

If you have a support contract, you should contact the Response Center and mention that fixes for these two bugs weren't delivered and you need a patch.
Nivel
Frequent Advisor

Re: C compiler warning

No solution was forthcoming from the replies received, but I managed to find a work-around in my code such that I did not need to use a function with a variable number of args.