Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#5519 closed Bugs (fixed)

Error C4235 in msvc_rounding_control.hpp (numeric.interval_lib.detail)

Reported by: hajokirchhoff Owned by: Jürgen Hunold
Milestone: To Be Determined Component: interval
Version: Boost 1.46.1 Severity: Problem
Keywords: rint numeric interval Cc:

Description

The code tests WIN64 when it should test _WIN64.

WIN64 is not a Microsoft standard preprocessor macro. _WIN64 is correct (see Microsoft documentation http://msdn.microsoft.com/en-us/library/b0084kay%28VS.80%29.aspx)

The effect is that the inline _asm function gets compiled when using the 64 Bit MSVC Compiler, which results in a C4235 error (_asm is not supported).

Fix: Use _WIN64 instead of WIN64 to test for 64 Bit MSVC

#if BOOST_MSVC < 1400 || defined(WIN64)
extern "C" { double rint(double); }
#else
inline double rint(double x)
{
_asm FLD [x] ;
_asm FRNDINT ;
//_asm RET ;
}
#endif

Attachments (1)

msvc_rounding_control.hpp.diff (416 bytes ) - added by anonymous 11 years ago.
Trivial fix

Download all attachments as: .zip

Change History (7)

comment:1 by hajokirchhoff, 11 years ago

The exact location of the error is msvc_rounding_control.hpp line 28, boost 1.46.1 when compiling with Visual Studio 2008 with x64 architecture.

comment:2 by Steven Watanabe, 11 years ago

Component: Noneinterval

by anonymous, 11 years ago

Trivial fix

comment:3 by Laurent.Rineau__CGAL@…, 11 years ago

The bug was created by the following revision in trunk, last year:

------------------------------------------------------------------------
r60227 | jhunold | 2010-03-06 15:17:49 +0100 (Sat, 06 Mar 2010) | 1 line

Disable x86 assembler for x64 builds.
------------------------------------------------------------------------
Index: msvc_rounding_control.hpp
===================================================================
--- msvc_rounding_control.hpp	(revision 60226)
+++ msvc_rounding_control.hpp	(revision 60227)
@@ -25,7 +25,7 @@
 namespace interval_lib {
 namespace detail {
 
-#if BOOST_MSVC < 1400
+#if BOOST_MSVC < 1400 || defined(WIN64)
 extern "C" { double rint(double); }
 #else
 inline double rint(double x)

WIN64 is not defined, only _WIN64 is.

comment:4 by wilx, 11 years ago

The patch is trivially correct and trivial, please apply it as soon as possible.

comment:5 by Jürgen Hunold, 11 years ago

Resolution: fixed
Status: newclosed

(In [77144]) Fix #5519: Use correct predefined _WIN64

comment:6 by Jürgen Hunold, 11 years ago

(In [77205]) Merge 77144 from /trunk

------------------------------------------------------------------------ r77144 | jhunold | 2012-02-29 21:49:52 +0100 (Mi, 29 Feb 2012) | 2 lines

Fix #5519: Use correct predefined _WIN64

------------------------------------------------------------------------

Note: See TracTickets for help on using tickets.