[Info-vax] c 7.3 - Why MAYLOSEDATA3 for long pointer math?
bcjitu at gmail.com
bcjitu at gmail.com
Fri Mar 13 03:50:48 EDT 2015
On Friday, 13 March 2015 13:19:57 UTC+5:30, bcj... at gmail.com wrote:
> On Monday, 21 July 2014 17:46:39 UTC+5:30, 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
>
> Hi,
>
> You may disable this warning by adding following line while compiling:
>
> /WARNINGS = DISABLE = ("MAYLOSEDATA3") NL:
>
> Regards,
> Jitendra Singh
More information about the Info-vax
mailing list