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

Incorrect warning for NAN, HUGE_VALF: "Floating-point operation result is out of range"

ZES
Beginner
573 Views

We try to compile this testcase:

#include <math.h>

int main() {
   float f1 = HUGE_VALF;
   decltype(HUGE_VALF) *f2 = &f1;
}

And get the following result

>icl samplelimits.cc
Intel(R) C++ Intel(R) 64 Compiler for applications running on IA-32, Version 16.
0 Build 20151021
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

samplelimits.cc
samplelimits.cc(4): warning #265: floating-point operation result is out of rang
e
     float f1 = HUGE_VALF;
                ^

Microsoft (R) Incremental Linker Version 14.00.23506.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:samplelimits.exe
samplelimits.obj

>

Judging from the error-message and the succeeding "decltype", HUGE_VALF has type float, but still, intel reports that "floating-point operand result is out of range". Same happens for NAN (with which it complains *twice* for the same line of code).

We use MSVC2015 Update 1 and the intel compiler version as specified in the output above.

0 Kudos
5 Replies
ZES
Beginner
573 Views

The consequence is that we get lots of warnings from <limits>, because in order to work-around https://software.intel.com/en-us/articles/limits1120-error-identifier-builtin-nanf-is-undefined , we needed to add macro-definitions for those builtin functions. This is very annoying.

0 Kudos
Bernard
Valued Contributor I
573 Views

Probably because HUGE_VALF is used to indicate overflow in type float and you are using it to initialize variable "f1" so compiler "thinks" that you will use this value as an argument in some computation.

 

0 Kudos
Melanie_B_Intel
Employee
573 Views

Thanks for this report. I created DPD200380653 in our internal bugs database to track the issue.

You can suppress the warning message using the icl option -wd265

0 Kudos
KitturGanesh
Employee
573 Views

Thx Melanie, I"ll monitor the issue and update the post when the release with the fix is out - appreciate much.
_KIttur

0 Kudos
KitturGanesh
Employee
573 Views

@Zes:
Hi,  Just letting you know that this issue is fixed in the latest 16.0 update 2 release which you can download and test it out. Thanks for bringing this issue to our attention and patience through this issue as well.
_Kittur

0 Kudos
Reply