[Info-vax] c 7.3 - Why MAYLOSEDATA3 for long pointer math?

Alan Fay alan_fay at btinternet.com
Sat Mar 14 18:42:25 EDT 2015


On Monday, 21 July 2014 13:16:39 UTC+1, John E. Malmberg  wrote:
> Hello All,
> 
> Can someone explain why the C compiler is generating this warning, and 
> how to change the code so that the C compiler is happy with out 
> suppressing the warning message?
> 
> All it is doing is subtracting two long pointers and putting the result 
> in either a unsigned or signed 64 bit value.
> 
> LION> cc/point=long/noopt/noobject test64.c
> 
>     c = b - a;
> .......^
> %CC-W-MAYLOSEDATA3, In this statement, "b-a" has a larger data size than 
> int.  Assignment can result in data loss.
> at line number 11 in file VMS_ROOT:[ld_tools]test64.c;10
> 
>     d = b - a;
> .......^
> %CC-W-MAYLOSEDATA3, In this statement, "b-a" has a larger data size than 
> int.  Assignment can result in data loss.
> at line number 12 in file VMS_ROOT:[ld_tools]test64.c;10
> 
> 
> LION> type test64.c
> #include <types.h>
> 
> unsigned __int64 foo(void) {
> 
>     char * a = "foo1";
>     char * b;
>     unsigned __int64 c;
>     __int64 d;
> 
>     b = &a[2];
>     c = b - a;
>     d = b - a;
> 
>     return c;
> }
> 
> HP C V7.3-020 on OpenVMS IA64 V8.4
> HP C V7.3-010 on OpenVMS Alpha V8.4
> 
> Regards,
> -John
> wb8tyw at qsl.network
> Personal Opinion Only

Duh! my mistake its 8 bytes.

Apologizes for misleading anyone.

Alan




More information about the Info-vax mailing list