Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7942 Discussions

error: expression must have arithmetic type

srimks
New Contributor II
1,962 Views

Hi.

I have a small query.

With GNU Compiler, I did wrote a program having a piece of code as belowwhich worked fine with GCC-v4.4 -

---

...
typedef double v2di __attribute__ ((vector_size(16)));
typedef float v4fi __attribute__ ((vector_size(16)));
...

more lines of code in btw.

..

v2di r[4];

....

---

but when I use Intel C++ Compiler(v-11.0 or v-10.0).

somewhere within the code where it has been used as data type, probably there is a mis-match between understanding of lvalue & rvalue by Intel C++ Compiler as above works fine with GNU Compiler, it gives an errors messages as -

--
error: expression must have arithmetic type
r[0] = pa[0] * pb[0];
^
--

Here, I guess that understanding of any Compiler for lvalue or rvalue are different OR Is the alignment as defined for GCC using typedef as above notcorrect to be used with ICC?

Any clue to resolve with ICC?

~BR

0 Kudos
1 Reply
TimP
Honored Contributor III
1,962 Views

As gcc-4.4 has good auto-vectorization capability, I would suggest standard C99 code for both gcc and icc, augmented by alignment attributes. If you don't like standard code, try the appropriate _mm_mul intrinsic.

0 Kudos
Reply