<?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 Potential error in examples/cblas/common_func.c in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Potential-error-in-examples-cblas-common-func-c/m-p/1042078#M20765</link>
    <description>&lt;P&gt;When compiling CBLAS examples on Intel64 I get a number of related warnings, which indicate a benign error present in the example code:&lt;/P&gt;

&lt;PRE class="brush:plain;"&gt;common_func.c(863): warning #810: conversion from "CBLAS_LAYOUT={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
             if ( (int)layout == CblasRowMajor )
                  ^

common_func.c(865): warning #810: conversion from "CBLAS_LAYOUT={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
             else if ( (int)layout == CblasColMajor )
                       ^

common_func.c(869): warning #810: conversion from "CBLAS_SIDE={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              if ( (int)side == CblasLeft )
                   ^

common_func.c(871): warning #810: conversion from "CBLAS_SIDE={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              else if ( (int)side == CblasRight )
                        ^

common_func.c(875): warning #810: conversion from "CBLAS_UPLO={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              if ( (int)uplo == CblasUpper )
                   ^

common_func.c(877): warning #810: conversion from "CBLAS_UPLO={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
             else if ( (int)uplo == CblasLower )
                       ^

common_func.c(881): warning #810: conversion from "CBLAS_DIAG={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              if ( (int)diag == CblasUnit )
                   ^

common_func.c(883): warning #810: conversion from "CBLAS_DIAG={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              else if ( (int)diag == CblasNonUnit )
                        ^

common_func.c(889): warning #810: conversion from "CBLAS_TRANSPOSE={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              if ( (int)trans == CblasNoTrans )
                   ^

common_func.c(891): warning #810: conversion from "CBLAS_TRANSPOSE={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              else if ( (int)trans == CblasTrans )
                        ^

common_func.c(893): warning #810: conversion from "CBLAS_TRANSPOSE={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              else if ( (int)trans == CblasConjTrans )
&lt;/PRE&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;It seems that the compiler is right to complain - the PrintParameters function errorneously declares some variables as pointers, when in fact they should be plain enums. This works, but the code is in error - variables are declared as pointers, but are used as plain enums for comparison, and those pointers are not dereferenced anywhere.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;With that in mind, for next release it should probably be patched as:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;--- common_func.c       2014-09-07 21:52:49.615764023 +0200
+++ common_func.c       2014-09-07 22:42:58.929931820 +0200
@@ -833,11 +833,11 @@

 void PrintParameters( char *names, ... )
 {
-    CBLAS_LAYOUT    *layout;
-    CBLAS_SIDE      *side;
-    CBLAS_UPLO      *uplo;
-    CBLAS_DIAG      *diag;
-    CBLAS_TRANSPOSE *trans;
+    CBLAS_LAYOUT     layout;
+    CBLAS_SIDE       side;
+    CBLAS_UPLO       uplo;
+    CBLAS_DIAG       diag;
+    CBLAS_TRANSPOSE  trans;
     char            *p, *str, str1[MAX_STRING_LEN], buf[MAX_STRING_LEN];
     va_list          ap;
     char             seps[]=" ,";
@@ -859,38 +859,38 @@
           p++;
        }
        if ( strcmp( str1, "layout" ) == 0 ) {
-           layout = va_arg( ap, CBLAS_LAYOUT* );
-           if ( (int)layout == CblasRowMajor )
+           layout = va_arg( ap, CBLAS_LAYOUT );
+           if ( layout == CblasRowMajor )
                 printf("LAYOUT = CblasRowMajor  ");
-           else if ( (int)layout == CblasColMajor )
+           else if ( layout == CblasColMajor )
                 printf("LAYOUT = CblasColMajor  ");
        } else if ( strcmp( str1, "side" ) == 0 ) {
-            side = va_arg( ap, CBLAS_SIDE * );
-            if ( (int)side == CblasLeft )
+            side = va_arg( ap, CBLAS_SIDE );
+            if ( side == CblasLeft )
                printf("SIDE = CblasLeft  ");
-            else if ( (int)side == CblasRight )
+            else if ( side == CblasRight )
                printf("SIDE = CblasRight  ");
        } else if ( strcmp( str1, "uplo" ) == 0 ) {
-            uplo = va_arg( ap, CBLAS_UPLO * );
-            if ( (int)uplo == CblasUpper )
+            uplo = va_arg( ap, CBLAS_UPLO );
+            if ( uplo == CblasUpper )
                printf("UPLO = CblasUpper  ");
-           else if ( (int)uplo == CblasLower )
+           else if ( uplo == CblasLower )
                printf("UPLO = CblasLower  ");
        } else if ( strcmp( str1, "diag" ) == 0 ) {
-            diag = va_arg( ap, CBLAS_DIAG * );
-            if ( (int)diag == CblasUnit )
+            diag = va_arg( ap, CBLAS_DIAG );
+            if ( diag == CblasUnit )
                printf("DIAG=CblasUnit  ");
-            else if ( (int)diag == CblasNonUnit )
+            else if ( diag == CblasNonUnit )
                printf("DIAG = CblasNonUnit  ");
        } else if ( ( strcmp( str1, "trans"  ) == 0 ) ||
                    ( strcmp( str1, "transa" ) == 0 ) ||
                    ( strcmp( str1, "transb" ) == 0 ) ) {
-            trans = va_arg( ap, CBLAS_TRANSPOSE * );
-            if ( (int)trans == CblasNoTrans )
+            trans = va_arg( ap, CBLAS_TRANSPOSE );
+            if ( trans == CblasNoTrans )
                printf("%s = CblasNoTrans  ", str);
-            else if ( (int)trans == CblasTrans )
+            else if ( trans == CblasTrans )
                printf("%s = CblasTrans  ", str);
-            else if ( (int)trans == CblasConjTrans )
+            else if ( trans == CblasConjTrans )
                printf("%s = CblasConjTrans  ", str);
        }
     } while ( (str = strtok( NULL, seps )) != NULL );
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 07 Sep 2014 20:55:10 GMT</pubDate>
    <dc:creator>Bartosz_W_</dc:creator>
    <dc:date>2014-09-07T20:55:10Z</dc:date>
    <item>
      <title>Potential error in examples/cblas/common_func.c</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Potential-error-in-examples-cblas-common-func-c/m-p/1042078#M20765</link>
      <description>&lt;P&gt;When compiling CBLAS examples on Intel64 I get a number of related warnings, which indicate a benign error present in the example code:&lt;/P&gt;

&lt;PRE class="brush:plain;"&gt;common_func.c(863): warning #810: conversion from "CBLAS_LAYOUT={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
             if ( (int)layout == CblasRowMajor )
                  ^

common_func.c(865): warning #810: conversion from "CBLAS_LAYOUT={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
             else if ( (int)layout == CblasColMajor )
                       ^

common_func.c(869): warning #810: conversion from "CBLAS_SIDE={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              if ( (int)side == CblasLeft )
                   ^

common_func.c(871): warning #810: conversion from "CBLAS_SIDE={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              else if ( (int)side == CblasRight )
                        ^

common_func.c(875): warning #810: conversion from "CBLAS_UPLO={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              if ( (int)uplo == CblasUpper )
                   ^

common_func.c(877): warning #810: conversion from "CBLAS_UPLO={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
             else if ( (int)uplo == CblasLower )
                       ^

common_func.c(881): warning #810: conversion from "CBLAS_DIAG={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              if ( (int)diag == CblasUnit )
                   ^

common_func.c(883): warning #810: conversion from "CBLAS_DIAG={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              else if ( (int)diag == CblasNonUnit )
                        ^

common_func.c(889): warning #810: conversion from "CBLAS_TRANSPOSE={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              if ( (int)trans == CblasNoTrans )
                   ^

common_func.c(891): warning #810: conversion from "CBLAS_TRANSPOSE={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              else if ( (int)trans == CblasTrans )
                        ^

common_func.c(893): warning #810: conversion from "CBLAS_TRANSPOSE={enum &amp;lt;unnamed&amp;gt;} *" to "int" may lose significant bits
              else if ( (int)trans == CblasConjTrans )
&lt;/PRE&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;It seems that the compiler is right to complain - the PrintParameters function errorneously declares some variables as pointers, when in fact they should be plain enums. This works, but the code is in error - variables are declared as pointers, but are used as plain enums for comparison, and those pointers are not dereferenced anywhere.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;With that in mind, for next release it should probably be patched as:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;--- common_func.c       2014-09-07 21:52:49.615764023 +0200
+++ common_func.c       2014-09-07 22:42:58.929931820 +0200
@@ -833,11 +833,11 @@

 void PrintParameters( char *names, ... )
 {
-    CBLAS_LAYOUT    *layout;
-    CBLAS_SIDE      *side;
-    CBLAS_UPLO      *uplo;
-    CBLAS_DIAG      *diag;
-    CBLAS_TRANSPOSE *trans;
+    CBLAS_LAYOUT     layout;
+    CBLAS_SIDE       side;
+    CBLAS_UPLO       uplo;
+    CBLAS_DIAG       diag;
+    CBLAS_TRANSPOSE  trans;
     char            *p, *str, str1[MAX_STRING_LEN], buf[MAX_STRING_LEN];
     va_list          ap;
     char             seps[]=" ,";
@@ -859,38 +859,38 @@
           p++;
        }
        if ( strcmp( str1, "layout" ) == 0 ) {
-           layout = va_arg( ap, CBLAS_LAYOUT* );
-           if ( (int)layout == CblasRowMajor )
+           layout = va_arg( ap, CBLAS_LAYOUT );
+           if ( layout == CblasRowMajor )
                 printf("LAYOUT = CblasRowMajor  ");
-           else if ( (int)layout == CblasColMajor )
+           else if ( layout == CblasColMajor )
                 printf("LAYOUT = CblasColMajor  ");
        } else if ( strcmp( str1, "side" ) == 0 ) {
-            side = va_arg( ap, CBLAS_SIDE * );
-            if ( (int)side == CblasLeft )
+            side = va_arg( ap, CBLAS_SIDE );
+            if ( side == CblasLeft )
                printf("SIDE = CblasLeft  ");
-            else if ( (int)side == CblasRight )
+            else if ( side == CblasRight )
                printf("SIDE = CblasRight  ");
        } else if ( strcmp( str1, "uplo" ) == 0 ) {
-            uplo = va_arg( ap, CBLAS_UPLO * );
-            if ( (int)uplo == CblasUpper )
+            uplo = va_arg( ap, CBLAS_UPLO );
+            if ( uplo == CblasUpper )
                printf("UPLO = CblasUpper  ");
-           else if ( (int)uplo == CblasLower )
+           else if ( uplo == CblasLower )
                printf("UPLO = CblasLower  ");
        } else if ( strcmp( str1, "diag" ) == 0 ) {
-            diag = va_arg( ap, CBLAS_DIAG * );
-            if ( (int)diag == CblasUnit )
+            diag = va_arg( ap, CBLAS_DIAG );
+            if ( diag == CblasUnit )
                printf("DIAG=CblasUnit  ");
-            else if ( (int)diag == CblasNonUnit )
+            else if ( diag == CblasNonUnit )
                printf("DIAG = CblasNonUnit  ");
        } else if ( ( strcmp( str1, "trans"  ) == 0 ) ||
                    ( strcmp( str1, "transa" ) == 0 ) ||
                    ( strcmp( str1, "transb" ) == 0 ) ) {
-            trans = va_arg( ap, CBLAS_TRANSPOSE * );
-            if ( (int)trans == CblasNoTrans )
+            trans = va_arg( ap, CBLAS_TRANSPOSE );
+            if ( trans == CblasNoTrans )
                printf("%s = CblasNoTrans  ", str);
-            else if ( (int)trans == CblasTrans )
+            else if ( trans == CblasTrans )
                printf("%s = CblasTrans  ", str);
-            else if ( (int)trans == CblasConjTrans )
+            else if ( trans == CblasConjTrans )
                printf("%s = CblasConjTrans  ", str);
        }
     } while ( (str = strtok( NULL, seps )) != NULL );
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Sep 2014 20:55:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Potential-error-in-examples-cblas-common-func-c/m-p/1042078#M20765</guid>
      <dc:creator>Bartosz_W_</dc:creator>
      <dc:date>2014-09-07T20:55:10Z</dc:date>
    </item>
    <item>
      <title>Hi Bartosz, </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Potential-error-in-examples-cblas-common-func-c/m-p/1042079#M20766</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://software.intel.com/en-us/user/1076534" style="font-size: 11px; line-height: 16.5px; background-color: rgb(238, 238, 238);"&gt;Bartosz&lt;/A&gt;,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thank you a lot for the reporting. &amp;nbsp;I will ask our build team to investigate and fix them if possible.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;It is true that there are the warnings. &amp;nbsp;And for someone who don't want to see them, &amp;nbsp;please use -w option to suppress. &amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Ying&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2014 07:07:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Potential-error-in-examples-cblas-common-func-c/m-p/1042079#M20766</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2014-09-15T07:07:38Z</dc:date>
    </item>
  </channel>
</rss>

