Intel 17

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Intel 17

Dominique Devienne
FYI, here are the modifications we did to a 3.19.3 amalgamation to build
with the Intel 17 compiler. Note that we have a few modifs of our own, so
line numbers might be off. --DD

PS: I hope the formatting goes through. Was garbled when I converted to
plain text, so trying in rich-text, sorry.


sqlite3.c
<http://codereview.pdgm.com:8080/ui#file:review=79667/version=1435759>(17654):
​​error ​​#265: ​​floating-point ​​operation ​​result ​​is ​​out ​​of
​​range

sqlite3.c
<http://codereview.pdgm.com:8080/ui#file:review=79667/version=1435759>.o:
sqlite3.c
<http://codereview.pdgm.com:8080/ui#file:review=79667/version=1435759>:function
sqlite3VdbeExec.h: error: undefined reference to '__builtin_add_overflow'

#define SQLITE_VERSION "3.19.3" #define SQLITE_VERSION_NUMBER 3019003
#define SQLITE_SOURCE_ID "2017-06-08 14:26:16
0ee482a1e0eae22e08edc8978c9733a96603d4509645f348ebf55b579e89636b"

---
//epos/trunk/library/SharedComponents/src/lib/pdgm/sqlite/core/sqlite3.c
+++
//epos/trunk/library/SharedComponents/src/lib/pdgm/sqlite/core/sqlite3.c @@
-17644,21 +17644,21 @@ result = s / scale; result /= 1.0e+308; }else{
result = s * scale; result *= 1.0e+308; } }else{ assert( e>=342 ); if(
esign<0 ){ result = 0.0*s; }else{ - result = 1e308*1e308*s; /* Infinity */
+ result = 1e308*(1e308*s); /* Infinity */ } } }else{ /* 1.0e+22 is the
largest power of 10 than can be ** represented exactly. */ while( e%22 ) {
scale *= 1.0e+1; e -= 1; } while( e>0 ) { scale *= 1.0e+22; e -= 22; } if(
esign<0 ){ result = s / scale; }else{ @@ -18429,56 +18429,56 @@ } } /* **
Attempt to add, substract, or multiply the 64-bit signed value iB against
** the other 64-bit signed integer at *pA and store the result in *pA. **
Return 0 on success. Or if the operation would have resulted in an **
overflow, leave *pA unchanged and return 1. */ SQLITE_PRIVATE int
sqlite3AddInt64(i64 *pA, i64 iB){ -#if GCC_VERSION>=5004000 +#if
GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER) return
__builtin_add_overflow(*pA, iB, pA); #else i64 iA = *pA; testcase( iA==0 );
testcase( iA==1 ); testcase( iB==-1 ); testcase( iB==0 ); if( iB>=0 ){
testcase( iA>0 && LARGEST_INT64 - iA == iB ); testcase( iA>0 &&
LARGEST_INT64 - iA == iB - 1 ); if( iA>0 && LARGEST_INT64 - iA < iB )
return 1; }else{ testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 1 );
testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 2 ); if( iA<0 && -(iA +
LARGEST_INT64) > iB + 1 ) return 1; } *pA += iB; return 0; #endif }
SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){ -#if
GCC_VERSION>=5004000 +#if GCC_VERSION>=5004000 &&
!defined(__INTEL_COMPILER) return __builtin_sub_overflow(*pA, iB, pA);
#else testcase( iB==SMALLEST_INT64+1 ); if( iB==SMALLEST_INT64 ){ testcase(
(*pA)==(-1) ); testcase( (*pA)==0 ); if( (*pA)>=0 ) return 1; *pA -= iB;
return 0; }else{ return sqlite3AddInt64(pA, -iB); } #endif } SQLITE_PRIVATE
int sqlite3MulInt64(i64 *pA, i64 iB){ -#if GCC_VERSION>=5004000 +#if
GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER) return
__builtin_mul_overflow(*pA, iB, pA); #else i64 iA = *pA; if( iB>0 ){ if(
iA>LARGEST_INT64/iB ) return 1; if( iA<SMALLEST_INT64/iB ) return 1; }else
if( iB<0 ){ if( iA>0 ){ if( iB<SMALLEST_INT64/iA ) return 1; }else if( iA<0
){
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Intel 17

Richard Hipp-3
On 9/11/17, Dominique Devienne <[hidden email]> wrote:
> FYI, here are the modifications we did to a 3.19.3 amalgamation to build
> with the Intel 17 compiler. Note that we have a few modifs of our own, so
> line numbers might be off. --DD
>
> PS: I hope the formatting goes through. Was garbled when I converted to
> plain text, so trying in rich-text, sorry.

The "rich text" is garbled and unreadable.

--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Intel 17

Dominique Devienne
On Mon, Sep 11, 2017 at 4:49 PM, Richard Hipp <[hidden email]> wrote:

> On 9/11/17, Dominique Devienne <[hidden email]> wrote:
> > FYI, here are the modifications we did to a 3.19.3 amalgamation to build
> > with the Intel 17 compiler. Note that we have a few modifs of our own, so
> > line numbers might be off. --DD
> >
> > PS: I hope the formatting goes through. Was garbled when I converted to
> > plain text, so trying in rich-text, sorry.
>
> The "rich text" is garbled and unreadable.
>

OK, sorry. Here's another try "hand-edited". Lines should be easy enough to
find hopefully.

===== 1st error =====
sqlite3.c(17654): error #265: floating-point operation result is out of
range

// around line 17644
- result = 1e308*1e308*s; /* Infinity */
+ result = 1e308*(1e308*s); /* Infinity */

===== 2nd error =====

sqlite3.c.o:sqlite3.c:function sqlite3VdbeExec.h: error: undefined
reference to '__builtin_add_overflow', etc...

  SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){
- #if GCC_VERSION>=5004000
+#if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER)
  return __builtin_add_overflow(*pA, iB, pA);
  #else

  SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){
- #if GCC_VERSION>=5004000
+#if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER)
  return __builtin_sub_overflow(*pA, iB, pA);
  #else

  SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){
- #if GCC_VERSION>=5004000
+ #if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER)
  return __builtin_mul_overflow(*pA, iB, pA);
  #else

Please note that I'm not saying this is the best fix.
A colleague made those changes to make it build.
It wasn't necessary with Intel 15. --DD
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Intel 17

Clemens Ladisch
Dominique Devienne wrote:
> sqlite3.c(17654): error #265: floating-point operation result is out of range

Could this error be reduced to a warning?

> // around line 17644
> - result = 1e308*1e308*s; /* Infinity */
> + result = 1e308*(1e308*s); /* Infinity */

C99 7.12 (<math.h>) says:
| 4 The macro INFINITY expands to a constant expression of type float
|   representing positive or unsigned infinity, if available; else to
|   a positive constant of type float that overflows at translation
|   time.*
|   * In this case, using INFINITY will violate the constraint in 6.4.4
|     and thus require a diagnostic.

So I guess an "#ifdef INFINITY" should be added.

This macro was introduced in C99 (as was strtod("INF")), so we still
need a fallback.  And if we don't want to hack the IEEE float bit
pattern, the only choices are overflow or "1.0/0.0".


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Intel 17

Dominique Devienne
On Tue, Sep 12, 2017 at 8:47 AM, Clemens Ladisch <[hidden email]> wrote:

> Dominique Devienne wrote:
> > sqlite3.c(17654): error #265: floating-point operation result is out of
> range
>
> Could this error be reduced to a warning?
>

Probably. We typically compile with a strict warning-as-error setting.


> > // around line 17644
> > - result = 1e308*1e308*s; /* Infinity */
> > + result = 1e308*(1e308*s); /* Infinity */
>
> C99 7.12 (<math.h>) says:
> | 4 The macro INFINITY expands to a constant expression of type float
> |   representing positive or unsigned infinity, if available; else to
> |   a positive constant of type float that overflows at translation
> |   time.*
> |   * In this case, using INFINITY will violate the constraint in 6.4.4
> |     and thus require a diagnostic.
>
> So I guess an "#ifdef INFINITY" should be added.
>
> This macro was introduced in C99 (as was strtod("INF")), so we still
> need a fallback.  And if we don't want to hack the IEEE float bit
> pattern, the only choices are overflow or "1.0/0.0".
>

Makes sense. --DD
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Intel 17

Richard Hipp-3
In reply to this post by Dominique Devienne
On 9/11/17, Dominique Devienne <[hidden email]> wrote:
> FYI, here are the modifications we did to a 3.19.3 amalgamation to build
> with the Intel 17 compiler. Note that we have a few modifs of our own, so
> line numbers might be off. --DD

Please try the latest trunk version of SQLite and let me know if it
works for you.
--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Intel 17

Clemens Ladisch
Richard Hipp wrote:
> Please try the latest trunk version of SQLite and let me know if it
> works for you.

I don't have the Intel compiler, but the sign is missing:

  SELECT CAST('-1e359' AS NUMBER), CAST('-1e360' AS NUMBER);
  -Inf|Inf


I take everything back and state the opposite: I guess an
"#ifndef INFINITY" should be added to set it if it does not exist.

And while we're at it: the "#include <math.h>" at the top of util.c is
guarded with HAVE_ISNAN, which is implied by C99, but now misleading.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Intel 17

Richard Hipp-3
On 9/12/17, Clemens Ladisch <[hidden email]> wrote:
> Richard Hipp wrote:
>> Please try the latest trunk version of SQLite and let me know if it
>> works for you.
>
> I don't have the Intel compiler, but the sign is missing:
>
>   SELECT CAST('-1e359' AS NUMBER), CAST('-1e360' AS NUMBER);
>   -Inf|Inf
>

Thanks.  Should be fixed now.
--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Intel 17

Dominique Devienne
In reply to this post by Richard Hipp-3
On Tue, Sep 12, 2017 at 3:56 PM, Richard Hipp <[hidden email]> wrote:

> On 9/11/17, Dominique Devienne <[hidden email]> wrote:
> > FYI, here are the modifications we did to a 3.19.3 amalgamation to build
> > with the Intel 17 compiler. Note that we have a few modifs of our own, so
> > line numbers might be off. --DD
>
> Please try the latest trunk version of SQLite and let me know if it works
> for you.
>

I'd need an amalgamation to easily do that, sorry. --DD
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users