- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As defined in IEEE-754 comparisons with NAN should always yield false, this works:
#define __STDC_WANT_DEC_FP__ #include <dfp754.h> if (0.4dd > nand64("")) { return 1; } return 0;
Now, __builtin_expect is to give advice to the compiler about the outcome of a boolean expression, it shouldn't change the code path at all, however it does:
#define __STDC_WANT_DEC_FP__ #include <dfp754.h> if (__builtin_expect(0.4dd > nand64(""), 0)) { return 1; } return 0;
This snippet compiled with icc (ICC) 17.0.4 20170411 will now return 1.
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sebastian,
I couldn't reproduce it at my end. It returned 0 in both cases. Can you give us you test case along with your command line options and the OS you run it on?
Regards,
Viet Hoang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
$ icc -std=gnu11 -fast -x c - -Wall -D__STDC_WANT_DEC_FP__ <<EOF #include <stdlib.h> #include <stdio.h> #include <string.h> #include <dfp754.h> #include <math.h> int main(int argc, char *argv[]) { if (__builtin_expect(0.4 > nand64(""), 0)) { return 1; } return 0; } EOF $ ./a.out || echo "broken" broken $
from /etc/os-release:
NAME=openSUSE
VERSION="13.1 (Bottle)"
VERSION_ID="13.1"
PRETTY_NAME="openSUSE 13.1 (Bottle) (x86_64)"
ID=opensuse
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:opensuse:13.1"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://opensuse.org/"
ID_LIKE="suse"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Now that I've had some more time to play with it, I found out, it's the -ipo bit (implied by -fast).
So icc -O3 works, icc -O0 -ipo, icc -O1 -ipo do too. Whereas icc -O2 -ipo and icc -O3 -ipo do not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It looks like a bug to me. Can you please submit a ticket at https://supporttickets.intel.com/ ?
Regards,
Viet Hoang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Certainly, thanks for confirming.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page