trouble with optimization on itanium and long double type.

trouble with optimization on itanium and long double type.

I think there is a problem with optimization in the ICC on itanium when it try to inline intrinsic function (here sqrtl) with the "long double" type.
The problem occurs if I do not specify the option "nolib_inline".

Below you will see my source code where I isolated the problem.
Some explanation : I In the inner loop of distances, u must be always equal to 1. r and t should be equal to 1.
Some random results are stored in the array Rij if "nolib_inline" isn't specified. Rij[i][j] must contain 1. So there is no special values (infinite, out of range, ...) as the documentation of "nolib_inline" says.

I use the version
$ icc -V
Intel C++ Itanium Compiler for Itanium-based applications
Version 8.0 Build 20040101 Package ID: l_cc_pc_8.0.058
Copyright (C) 1985-2003 Intel Corporation. All rights reserved.

$ uname -a
Linux xxxx #1 SMP Wed May 21 17:47:59 EDT 2003 ia64 unknown
(redhat Advanced server 2.1)

The command compilation is :
$ icc -O3 -mp -nolib_inline test1.c -o test1
$ icc -O3 -mp test1.c -o test1

Is this a bug of icc ? Should I report it to the support ?

M. Gastineau,

#include "stdio.h"
#include "math.h"

#define NTOTAL 10

long double y[NTOTAL*6];
long double Rij[NTOTAL][NTOTAL];

void distances(int ntab, long double y[ntab]);

void distances(int ntab, long double y[ntab])
long double t, u;
long double r;
int j, i;

/* compute Rij */
for(j=0; j {
for(i=0; i {
u = (y[6*j+1]-y[6*i+5])*(y[6*j+1]-y[6*i+5]);
r = sqrtl(u);
t = 1.0E0L/r;
Rij[i][j] = t;
/* print Rij */
for (j=0; j for (i=0; i {
printf("%d %d %23.16LE
", i,j, Rij[i][j]);

int main()
int i,j;
for (i=0; i< 6*NTOTAL; i++)
distances(6*NTOTAL, y);

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I'm able to reproduce this problem on RH AS 2.1, but not on RH EL 3.0. I created 2 preprocessed files (on AS 2.1 & EL 3) that shows the differences which is attached. A lot of the differences deal with definitions of variables sizes. Do you have access to RH EL 3 ? I suggest submitting an issue to on this issue with you're test case and the diff file on EL3 vs AS 2.1 so we can see if there is a work around. It would be useful to check with Red Hat to see if there are updates to AS 2.1 that deal with this.


John O'Neill

I didn't have access to redhat 3.0.
But I will report this problem to the



Leave a Comment

Please sign in to add a comment. Not a member? Join today