<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Alpha to Integrity application porting - issue in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720343#M36908</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your review and replies.&lt;/P&gt;&lt;P&gt;Here is my response/clarifcation to your queries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To Eberhard:&lt;/P&gt;&lt;P&gt;Yes, strange indeed. If routine Foo is declared in the same file as main, then both float values printed out are the same, REGARDLESS if the compile option /FLOAT=ieee_float or /FLOAT=g_float is used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if Foo is declared as a separate C file, then it gets interesting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When compiled with ieee_float, result is normal. With /FLOAT=g_float, the values are mangled&lt;/P&gt;&lt;P&gt;Here what I got when I compiled BOTH the C files (myprogram.c, foo.c) with cc/float=g_float, and linked as link myprogram, foo.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Float value in main = 12233.000000 (hex)=e48040e7)&lt;BR /&gt;Float value in Foo = 1.811661 (hex=fc90401c)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To ABSRVC (Dan):&lt;/P&gt;&lt;P&gt;We actually encountered 2 issues.&lt;/P&gt;&lt;P&gt;The 2nd issue is with the float variable, which I wrote simple C programs to prove the point.&lt;/P&gt;&lt;P&gt;The output is as displayed above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To Duncan:&lt;/P&gt;&lt;P&gt;Yes, if we put the FOO routine in the same file as the main (MYPROGRAM.C), then we don't have a problem (whether we compile with IEEE_FLOAT or G_FLOAT).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The float value &amp;nbsp;changes only when FOO routine is in its own file (FOO.C), and we compile both files (FOO.C and MYPROGRAM.C) with G_FLOAT. Why is this not documented by HP, or maybe I'm overlooking something.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To Craig:&lt;/P&gt;&lt;P&gt;Yes, I compiled both C files with the same /FLOAT option. With /FLOAT=IEEE_FLOAT, no problem, but with /FLOAT=G_FLOAT, I get mangled float variable values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your 1st query, yes, those FP data are G_FLOAT.&lt;/P&gt;&lt;P&gt;I did step through, and when I examine in BINARY, it shows zeroes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;examine/binary common_double_variable_read_from_file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will examine in g_float and d_float and let you know the outcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To Hein:&lt;/P&gt;&lt;P&gt;I did init the local variable double.&lt;/P&gt;&lt;P&gt;But I think the FLTINV exception is triggered by the common_double_variable_read_from_file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;double my_local_double = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;my_local_double += common_double_variable_read_from_file;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any clarification is appreciated. I'm trying to avoid doing Database conversion,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;Joel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Jul 2012 21:26:16 GMT</pubDate>
    <dc:creator>Jenwae</dc:creator>
    <dc:date>2012-07-11T21:26:16Z</dc:date>
    <item>
      <title>Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5719497#M36901</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Fortran application running on Alpha 8.3 re-written in C and now being ported to Integrity.&lt;/P&gt;&lt;P&gt;The application reads from and writes to legacy binary data files on disk.&lt;/P&gt;&lt;P&gt;We have re-compiled the C application with the option /FLOAT=G_FLOAT to support the data files.&lt;/P&gt;&lt;P&gt;Everything seems to run just fine, except for 2 issues we recently encountered:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) On certain occasion, the application will crash with SYSTEM-F-FLTINV, floating invalid operation.&lt;/P&gt;&lt;P&gt;For example, at the source line:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;double my_local_double;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;my_local_double += common_double_variable_read_from_file;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) We have variables declared as float. Apparently, after compiling in g_float, the data in the float changed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So we wrote a small program to test out.&lt;/P&gt;&lt;P&gt;The value changed after passed to a subroutine/function.&lt;/P&gt;&lt;P&gt;For example, in MYPROGRAM.C&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; int main() {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;float my_local_float = 12233.00&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;printf(" Float value = %f", my_local_float");&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;foo(my_local_float);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In FOO.C&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; void foo(float x) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; printf(" Float value = %f", x);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value printed in MYPROGRAM.C is different than in FOO.C&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice is appreciated.&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2012 08:51:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5719497#M36901</guid>
      <dc:creator>Jenwae</dc:creator>
      <dc:date>2012-07-11T08:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5719735#M36902</link>
      <description>&lt;P&gt;Strange:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void foo(float x) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(" Float value = %f", x);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;int main() {&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; float my_local_float = 12233.00;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(" Float value = %f", my_local_float);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foo(my_local_float);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ cc/float=g_float tf.c&lt;/P&gt;&lt;P&gt;$ link tk&lt;/P&gt;&lt;P&gt;$ r tf&lt;/P&gt;&lt;P&gt;&amp;nbsp;Float value = 12233.000000 Float value = 12233.000000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ cc/version&lt;BR /&gt;HP C V7.3-020 on OpenVMS IA64 V8.4&lt;/P&gt;&lt;P&gt;+ all actual patches (i.e. CRTL)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eberhard&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2012 11:27:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5719735#M36902</guid>
      <dc:creator>Eberhard Heuser</dc:creator>
      <dc:date>2012-07-11T11:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5719821#M36903</link>
      <description>&lt;P&gt;One thing that would be helpful here is knowing what the actual difference is.&amp;nbsp; Please provide the actual output from the programs as listed that show the problem.&amp;nbsp; Also, you initially describe using double, yet the supplied program uses standard float.&amp;nbsp; Where is the problem, with double float or float?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you can show the different values, please also print out the variables in hex.&amp;nbsp; An examination of the actual stored binary (in hex) will be helpful as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2012 12:45:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5719821#M36903</guid>
      <dc:creator>abrsvc</dc:creator>
      <dc:date>2012-07-11T12:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5719845#M36904</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Look out for your compiler warnings!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ ty test.c&lt;BR /&gt;int main() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; float my_local_float = 12233.00;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(" Float value = %f", my_local_float);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foo(my_local_float);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;void foo(float x) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(" Float value = %f", x);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;produces:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ cc/ver&lt;BR /&gt;HP C V7.3-020 on OpenVMS IA64 V8.4&lt;BR /&gt;$ cc/float=g_float test&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(" Float value = %f", my_local_float);&lt;BR /&gt;.......^&lt;BR /&gt;%CC-I-IMPLICITFUNC, In this statement, the identifier "printf" is implicitly declared as a function.&lt;BR /&gt;at line number 3 in file SYS$SYSROOT:[SYSMGR]TEST.C;2&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foo(my_local_float);&lt;BR /&gt;.......^&lt;BR /&gt;%CC-I-IMPLICITFUNC, In this statement, the identifier "foo" is implicitly declared as a function.&lt;BR /&gt;at line number 4 in file SYS$SYSROOT:[SYSMGR]TEST.C;2&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;void foo(float x) {&lt;BR /&gt;.....^&lt;BR /&gt;%CC-W-NOTCOMPATIMP, In this declaration, the type of the function "foo" is not compatible with the earlier implicit declaration of "&lt;BR /&gt;foo" at line number 4 in file SYS$SYSROOT:[SYSMGR]TEST.C;2.&lt;BR /&gt;at line number 7 in file SYS$SYSROOT:[SYSMGR]TEST.C;2&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;$ link test&lt;BR /&gt;%ILINK-W-COMPWARN, compilation warnings&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; module: TEST&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file: SYS$SYSROOT:[SYSMGR]TEST.OBJ;3&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;$ run test&lt;BR /&gt;&amp;nbsp;Float value = 12233.000000 Float value = 1.811661&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;but&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ ty test.c&lt;BR /&gt;void foo(float x) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(" Float value = %f", x);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;int main() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; float my_local_float = 12233.00;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(" Float value = %f", my_local_float);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foo(my_local_float);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;$ cc/float=g_float test&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(" Float value = %f", x);&lt;BR /&gt;......^&lt;BR /&gt;%CC-I-IMPLICITFUNC, In this statement, the identifier "printf" is implicitly declared as a function.&lt;BR /&gt;at line number 2 in file SYS$SYSROOT:[SYSMGR]TEST.C;3&lt;BR /&gt;$ link test&lt;BR /&gt;$ run test&lt;BR /&gt;&amp;nbsp;Float value = 12233.000000 Float value = 12233.000000&lt;BR /&gt;$&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Duncan&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2012 13:07:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5719845#M36904</guid>
      <dc:creator>Duncan Morris</dc:creator>
      <dc:date>2012-07-11T13:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5719879#M36905</link>
      <description>If you have shown the same as the original poster, then this is clearly an indication that the "bits" of the variable are being interpreted differently (as one would expect).&lt;BR /&gt;&lt;BR /&gt;The variables are passed by reference. In other words the memory address of the variable is passed NOT the actual variable value. This means that at address A, the bits are interpreted as a G_float using 64 bits and in the FOO routine, address A is interpreted as a float using 32 bits.&lt;BR /&gt;&lt;BR /&gt;All floating numbers are composed of 3 parts:&lt;BR /&gt;1) Sign bit&lt;BR /&gt;2) Exponent&lt;BR /&gt;3) fraction bits&lt;BR /&gt;&lt;BR /&gt;For G_float, bits 0-51 are part of the fraction&lt;BR /&gt;&lt;BR /&gt;Note that the fraction portion of hte G_float will be the only part used if the address is viewed as a standard 32 bit floating variable. Thus the difference in reported value.&lt;BR /&gt;&lt;BR /&gt;Dan</description>
      <pubDate>Wed, 11 Jul 2012 13:27:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5719879#M36905</guid>
      <dc:creator>abrsvc</dc:creator>
      <dc:date>2012-07-11T13:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720033#M36906</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;a href="https://community.hpe.com/t5/user/viewprofilepage/user-id/1163788"&gt;@abrsvc&lt;/a&gt; wrote:&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;The variables are passed by reference.&lt;/EM&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;No, in C they are passed by value, but the value placed on the stack is in the format of the caller.&amp;nbsp; If the function called expects a different format, bad things happen.&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;For the OP question #1.&amp;nbsp; Are you absolutely certain the data read from the file are G_FLOAT, not D_FLOAT and that there aren't other problems such as structure member alignment in the move from Fortran to C?&amp;nbsp; Have you stepped through the program in the debugger and done&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;examine/g_float common_double_variable_read_from_file&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;examine/d_float common_double_variable_read_from_file&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;?&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;For question #2, are you sure you are recompiling both modules myprogram.c and foo.c with the same floating point options?&amp;nbsp; If one is compiled with /G_FLOAT and one is not, you will very likely get the symptom you are seeing or worse.&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 11 Jul 2012 15:02:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720033#M36906</guid>
      <dc:creator>Craig A Berry</dc:creator>
      <dc:date>2012-07-11T15:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720313#M36907</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;     double my_local_double;
     my_local_double += common_double_variable_read_from_file;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As presented, that's broken / unpredictable code because my_local_double is not initialized.&lt;/P&gt;&lt;P&gt;Try:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;double my_local_double = 0;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;fwiw,&lt;/P&gt;&lt;P&gt;Hein.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2012 20:37:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720313#M36907</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2012-07-11T20:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720343#M36908</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your review and replies.&lt;/P&gt;&lt;P&gt;Here is my response/clarifcation to your queries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To Eberhard:&lt;/P&gt;&lt;P&gt;Yes, strange indeed. If routine Foo is declared in the same file as main, then both float values printed out are the same, REGARDLESS if the compile option /FLOAT=ieee_float or /FLOAT=g_float is used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if Foo is declared as a separate C file, then it gets interesting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When compiled with ieee_float, result is normal. With /FLOAT=g_float, the values are mangled&lt;/P&gt;&lt;P&gt;Here what I got when I compiled BOTH the C files (myprogram.c, foo.c) with cc/float=g_float, and linked as link myprogram, foo.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Float value in main = 12233.000000 (hex)=e48040e7)&lt;BR /&gt;Float value in Foo = 1.811661 (hex=fc90401c)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To ABSRVC (Dan):&lt;/P&gt;&lt;P&gt;We actually encountered 2 issues.&lt;/P&gt;&lt;P&gt;The 2nd issue is with the float variable, which I wrote simple C programs to prove the point.&lt;/P&gt;&lt;P&gt;The output is as displayed above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To Duncan:&lt;/P&gt;&lt;P&gt;Yes, if we put the FOO routine in the same file as the main (MYPROGRAM.C), then we don't have a problem (whether we compile with IEEE_FLOAT or G_FLOAT).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The float value &amp;nbsp;changes only when FOO routine is in its own file (FOO.C), and we compile both files (FOO.C and MYPROGRAM.C) with G_FLOAT. Why is this not documented by HP, or maybe I'm overlooking something.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To Craig:&lt;/P&gt;&lt;P&gt;Yes, I compiled both C files with the same /FLOAT option. With /FLOAT=IEEE_FLOAT, no problem, but with /FLOAT=G_FLOAT, I get mangled float variable values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your 1st query, yes, those FP data are G_FLOAT.&lt;/P&gt;&lt;P&gt;I did step through, and when I examine in BINARY, it shows zeroes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;examine/binary common_double_variable_read_from_file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will examine in g_float and d_float and let you know the outcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To Hein:&lt;/P&gt;&lt;P&gt;I did init the local variable double.&lt;/P&gt;&lt;P&gt;But I think the FLTINV exception is triggered by the common_double_variable_read_from_file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;double my_local_double = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;my_local_double += common_double_variable_read_from_file;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any clarification is appreciated. I'm trying to avoid doing Database conversion,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;Joel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2012 21:26:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720343#M36908</guid>
      <dc:creator>Jenwae</dc:creator>
      <dc:date>2012-07-11T21:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720345#M36909</link>
      <description>&lt;P&gt;James,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;We have re-compiled the C application with the option /FLOAT=G_FLOAT to support the data files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd recommend you bite the bullet and convert everything to the native floating format of your new system (IEEE). Making the application non-standard for the sake of some legacy data files&amp;nbsp;is a bad tradeoff. You risk the consequences of floating format mismatches (which is almost certainly what's going on here), as well as potential performance issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Build yourself a small program to convert the data in any existing files. In theory this should be very simple and very easy to validate. Tag the data files so you can tell if they're in the wrong format. The extra effort will be well worth it in the long run, even if there's a lot of data. You don't need to convert everything&amp;nbsp;up front, just as needed. (Indeed,&amp;nbsp;you could even build a&amp;nbsp;conversion step into the application itself, making it transparent to users).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2012 21:30:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720345#M36909</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2012-07-11T21:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720357#M36910</link>
      <description>&lt;P&gt;How did you compile the Fortran application?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Don't forget that the default changed from VAX F/G on Alpha to IEEE S/T on Itanium.&amp;nbsp; It changed for BOTH Fortran and C.&amp;nbsp; And the /IEEE_MODE changed from FAST to DENORM.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2012 21:42:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720357#M36910</guid>
      <dc:creator>jreagan</dc:creator>
      <dc:date>2012-07-11T21:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720375#M36911</link>
      <description />
      <pubDate>Wed, 11 Jul 2012 22:12:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720375#M36911</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2012-07-11T22:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720941#M36912</link>
      <description>&lt;P&gt;I think the moral is that it is easier to get your code to compile without warnings, than it is to work out what the consequences of not doing so are.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2012 10:54:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5720941#M36912</guid>
      <dc:creator>Richard Brodie_1</dc:creator>
      <dc:date>2012-07-12T10:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5721113#M36913</link>
      <description>&lt;P&gt;It is documented in the language reference guide:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Arguments to functions that have no prototype in scope are not converted to the types of the parameters. Instead, the expressions in the argument list are converted according to the following rules:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Any arguments of type &lt;FONT size="+1"&gt;float&lt;/FONT&gt; are converted to &lt;FONT size="+1"&gt;double&lt;/FONT&gt; .&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://h71000.www7.hp.com/commercial/c/docs/6180profile_014.html#func_arg_convert_sec"&gt;http://h71000.www7.hp.com/commercial/c/docs/6180profile_014.html#func_arg_convert_sec&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2012 12:47:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5721113#M36913</guid>
      <dc:creator>Richard Brodie_1</dc:creator>
      <dc:date>2012-07-12T12:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5721445#M36914</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for helping in our issues. It helps to have so many expertise around.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To Richard and Steven, thank you, Your explanation provided the solution to Issue #2 regarding the float variable. By doing proper prototyping, the mystery is resolved. (We had prototype the function foo, but without the argument type).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are still mystified with Issue #1.&lt;/P&gt;&lt;P&gt;Although we have compiled our application with /FLOAT=g_float, sometimes when computing on certain double variable (read from the file), it crashed. I have debugged and examine the value /binary, and it all shows zeroes. I think the FLTINV is triggered on the double field read from the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I reproduce my query below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) On certain occasion, the application will crash with SYSTEM-F-FLTINV, floating invalid operation.&lt;/P&gt;&lt;P&gt;For example, at the source line:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;double my_double = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;my_double = 1st_common_double_field_read_from_file + 2nd_common_double_field_read_from_file;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2012 16:51:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5721445#M36914</guid>
      <dc:creator>Jenwae</dc:creator>
      <dc:date>2012-07-12T16:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5721459#M36915</link>
      <description>&lt;P&gt;RE: FLTINV message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Per the definition/format of a G_Float number, the above message will likely appear if the sign bit is set and the exponent bits are zero(0).&amp;nbsp; This would appear as 80000000 hex if you look at a register value and 00000080hex if in memory.&amp;nbsp; This is per the Alpha arch reference pg 2-5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I realize that this is on an I64 machine, but I believe that the same rules apply regarding the sign bit and exponent portion.&amp;nbsp; Verify the bit layout with the debugger.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2012 17:02:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5721459#M36915</guid>
      <dc:creator>abrsvc</dc:creator>
      <dc:date>2012-07-12T17:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5721463#M36916</link>
      <description />
      <pubDate>Thu, 12 Jul 2012 17:09:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5721463#M36916</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2012-07-12T17:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5722197#M36917</link>
      <description>&lt;P&gt;&amp;gt;We had prototype the function foo, but without the argument type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a K&amp;amp;R prototype, next to useless.&amp;nbsp; It might be helpful if you port your application to C++ or C99, at least to get the strong type checking.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2012 10:37:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5722197#M36917</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-07-13T10:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5732889#M36918</link>
      <description>&lt;P&gt;As a side note, running the VMS debugger and doing DBG&amp;gt; SHOW SYMBOL/TYPE variable might have helped you pinpoint the problem quicker. Be aware that I did not test on your actual case. This is just a free advice.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jul 2012 14:38:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5732889#M36918</guid>
      <dc:creator>Ph Vouters</dc:creator>
      <dc:date>2012-07-21T14:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5732919#M36919</link>
      <description>&lt;P&gt;About dealing with VAX Floats on Itanium, this document proves that it is always better to deal with IEEE floats if code performance is an issue. The document is viewable at :&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://vouters.dyndns.org/tima/OpenVMS-IA64-VAX-IEEE-floats-Performances_on_double_operations.html"&gt;http://vouters.dyndns.org/tima/OpenVMS-IA64-VAX-IEEE-floats-Performances_on_double_operations.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Philippe&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jul 2012 15:55:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5732919#M36919</guid>
      <dc:creator>Ph Vouters</dc:creator>
      <dc:date>2012-07-21T15:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Alpha to Integrity application porting - issue</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5736199#M36920</link>
      <description>&lt;P&gt;Note that Ph's analysis of D vs T is the worst case.&amp;nbsp; D_FLOAT conversion is very ugly compared to G to T (and T to G).&amp;nbsp; The layout of D float requires more code to detect various invalid floatings, NaNs, etc.&amp;nbsp; The D-to-T routine is much more complicated (more instructions and more registers) than G-to-T.&amp;nbsp; The S-to-F isn't a picnic either to handle all the edge conditions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IEEE is much preferred on Itanium (which is why we changed the default) but if you have to use a VAX floating format, G would be my pick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jul 2012 18:57:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/alpha-to-integrity-application-porting-issue/m-p/5736199#M36920</guid>
      <dc:creator>jreagan</dc:creator>
      <dc:date>2012-07-23T18:57:19Z</dc:date>
    </item>
  </channel>
</rss>

