[MDEV-6802] Build fails with clang on amd64 Created: 2014-09-27 Updated: 2014-11-23 Resolved: 2014-09-30 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Affects Version/s: | 10.0.14 |
| Fix Version/s: | 10.0.15 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Bernard Spil | Assignee: | Olivier Bertrand |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | connect-engine | ||
| Environment: |
FreeBSD bobthebuilder 10.0-RELEASE-p7 FreeBSD 10.0-RELEASE-p7 #0: Tue Jul 8 06:37:44 UTC 2014 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
When building MariaDB 10.0.14 using clang 3.3 on FreeBSD amd64, there's a compile error in storage/connect/filamap.h 107: virtual int GetNextPos(void) {return (int)Fpos + Nrec;}error: cast from pointer to smaller type 'int' loses information int is a 32-bit type this will not fit a memory address of a 64-bit platform. This should probably be handled using a uintptr_t type which should be available on all platforms. |
| Comments |
| Comment by Bernard Spil [ 2014-09-27 ] | ||||||||
|
Patches that enable build on FreeBSD 10.0 clang 3.3 | ||||||||
| Comment by Bernard Spil [ 2014-09-27 ] | ||||||||
|
And a patch for | ||||||||
| Comment by Olivier Bertrand [ 2014-09-29 ] | ||||||||
|
This function was wrongly defined but fortunately never used. However, it was fixed (just in case...) as:
| ||||||||
| Comment by Bernard Spil [ 2014-09-29 ] | ||||||||
|
Great! | ||||||||
| Comment by Olivier Bertrand [ 2014-09-29 ] | ||||||||
|
Sorry, I closed this before reading your last comments. About your patches: in filamap.h: in filamap.cpp:
and the same casting in MPXFAM::InitDelete. This is not necessary with the MS or GCC compilers. Let me know whether it is with clang. In array.cpp: | ||||||||
| Comment by Olivier Bertrand [ 2014-09-29 ] | ||||||||
|
Reopened until you tell me whether my last suggestions work with clang | ||||||||
| Comment by Bernard Spil [ 2014-09-29 ] | ||||||||
|
Thanks for your guidance Olivier Please find revised patches attached, Mariadb-10.0.14 builds on FreeBSD 10.0 with these patches. | ||||||||
| Comment by Olivier Bertrand [ 2014-09-30 ] | ||||||||
|
I applied the new patches successfully on Windows. However, on Linux the GCC compiling failed saying that uintptr_t was undeclared.
into the Unix declare section. | ||||||||
| Comment by Bernard Spil [ 2014-09-30 ] | ||||||||
|
Hi Olivier, | ||||||||
| Comment by Olivier Bertrand [ 2014-09-30 ] | ||||||||
|
This should fix all compiler issues. However, to do it in a cleaner way, I did not exactly apply the above patches: In the InitDelete functions I changed the cast from uintptr_t to ptrdiff_t, which seems more appropriate and does not require including stdint.h. About the array making, I have added an union in the PARM structure:
This makes possible to suppress all the funny casting that were done when creating the structure (in TXTFAM::AddListValue) and retrieving the integer value from it (in MakeValueArray) |