[Info-vax] C troubles: BADSTATICCVT

hb end.of at inter.net
Fri Feb 2 08:18:50 EST 2018


On 02/02/2018 12:49 AM, Craig A. Berry wrote:
> $ cc static_const1
> 
>     42, (intptr_t)"."
> ..................^
> %CC-E-BADSTATICCVT, In the initializer for mydata[0].nonsense, the
> address cannot be converted to the destination type.
> at line number 9 in file D0:[craig.TEST]static_const1.c;3
> 
> HELP CC MESSAGES BADSTATICCVT tells me, "A static initialization tried
> to convert a link-time address to another type. However, the linker on
> this platform will not support such a conversion." And also that I
> should, "Rewrite the static initialization, or perform the
> initialization using runtime code."

Probably someone else can and will explain the error code (to me it
looks like the compiler hesitates to issue a relocation the linker can't
process) I only observed that without the cast, there is an additional
warning

$ cc static_const1.c/pointer=64

    42, "."
........^
%CC-W-CVTDIFTYPES, In the initializer for mydata[0].nonsense, ""."" of
type "short pointer to char", is being converted to "__int64".

As a workaround, you may want to cast to int32_t. This seems to work for
HP C V7.3-010 on OpenVMS Alpha V8.4-2L2.




More information about the Info-vax mailing list