View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0024537 | Open CASCADE | OCCT:Foundation Classes | public | 2014-01-16 13:04 | 2020-11-25 17:37 |
Reporter | Assigned To | kgv | |||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Platform | Linux | OS | Debian 6.0 | ||
Product Version | 6.7.0 | ||||
Target Version | 7.0.0 | Fixed in Version | 7.0.0 | ||
Summary | 0024537: GCC compiler warnings in byte order reversion code | ||||
Description | GCC produces warnings on breakage of pointer aliasing rules in code related to conversion of data between low-endian and big-endian formats, see 0024252: FSD_FileHeader.hxx:101: warning: dereferencing type-punned pointer will break strict-aliasing rules BinObjMgt_Persistent.cxx:1109: warning: dereferencing type-punned pointer will break strict-aliasing rules FSD_BinaryFile.cxx:417: warning: dereferencing type-punned pointer will break strict-aliasing rules The code can be corrected to use unions for this conversion. The problem however is that that code is not tested now, as all currently supported platforms are based on Intel x86 architecture and thus are low-endian. Thus specific tests need to be created for this functionality. It is also a question whether big-endian platforms need to be supported at all. As it seems, existing and potential target platforms for OCCT (including iOS and Android on ARM processors) all use little-endian convention (even if ARM is bi-endian). | ||||
Steps To Reproduce | test bugs fclasses bug24537 | ||||
Tags | No tags attached. | ||||
Test case number | bugs fclasses bug24537 | ||||
|
Branch CR24537_test has been created by dln. SHA-1: 237c2596f5711322edf6eb29fc27d7162ec86bf6 Detailed log of new commits: Author: dln Date: Tue Sep 9 14:54:08 2014 +0400 0024537: GCC compiler warnings in byte order reversion code - preliminary version of the fix for test |
|
Branch CR24537_test has been updated forcibly by dln. SHA-1: 8581a1d295fc6f79c8bc9033179bfcca56e49d36 |
|
Branch CR24537_test has been updated forcibly by dln. SHA-1: e1eb782e1d1b514737e15e7f705ff554c5f69c7d |
|
Dear abv, check it please |
|
Branch CR24537 has been created by msv. SHA-1: c468fd82b8a59892e99a5de36b78cba88027698e Detailed log of new commits: Author: dln Date: Tue Sep 9 14:54:08 2014 +0400 0024537: GCC compiler warnings in byte order reversion code - warnings in byte order inversion functionality is fixed with unions - test case (simulation of conversion to big endian) is added |
|
Please review again. |
|
Sorry, the new test case fails on x64 platform. It needs to be reworked. |
|
Branch CR24537 has been updated forcibly by msv. SHA-1: 22536d3284dadf8a6e70f49295211db77c4f6012 |
|
The test case has been reworked. Now it is completely hard-coded inside the draw command OCC24537. Andrey, please review the branch CR24537. |
|
I suggest that some corrections should be made: 1. In FSD_FileHeader.hxx: - it can be worth moving this code to cxx or separate header (in BinTools?), to avoid defining this stuff (very special and not used in practice) globally - it can be worth renaming macro DO_INVERSE to something more specific, at least prefix it with "OCCT_" - it can be worth adding Standard_StaticAssert to check that sizeof(ShortReal) == sizeof(Integer) and sizeof(Real) == 2 * sizeof(Integer) etc.; alternatively templated version can be used (just as for Size) - InverseSizeSpecialized <4> can be just a call to InverseInt() - InverseLong() is obviously not correct for 64-bit systems where long is 8 bytes in size; it can be removed as unused, or implemented in the same way as for Size 2. In BinObjMgt_Persistent.cxx: - I believe this will not work as before on 32-bit systems, since before aData was double* (incremented by 8 bytes) and now &aWrapUnion.anAddrData is void** (incremented by 4 bytes): - aPrevPtr = &aData[aLenInPiece / BP_REALSIZE]; + aPrevPtr = (&aWrapUnion.anAddrData)[aLenInPiece / BP_REALSIZE]; - I deem that casting char* to double* is generally bad idea, since on some architectures this may cause alignment failure. Why not just to move along myData by 8-byte sequences, copying them to buffer, then converting and placing back? 3. In QABugs_19.cxx: I suggest using more disperse set of probing values, not just 1-2-3. For instance: - int: -4000000, -1234, 0, 1, 1234, 4000000 - double: -1e300, -1e-9, 0., 1.e-9, 1., 3.1415296, 1e100 - float: -1e-9, 0., 1.e-9, 1., 3.1415 |
|
Branch CR24537 has been updated forcibly by msv. SHA-1: 729a7c27424752e546968b44eab13a77dba3b06d |
|
I have considered some remarks. It is needed to continue the fix. The current version of the branch CR24537 must be re-based on current master before continuing. It can be not compilable. |
|
Branch CR24537_3 has been created by rkv. SHA-1: ff03877408cf1a23f6c3594c60e3e1d0b4b304cc Detailed log of new commits: Author: rkv Date: Tue Sep 22 12:48:04 2015 +0300 0024537: GCC compiler warnings in byte order reversion code - warnings in byte order inversion functionality is fixed with unions - test case (simulation of conversion to big endian) is added |
|
Reviewed. |
|
Dear BugMaster, Branch CR24537_3 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode. SHA-1: ff03877408cf1a23f6c3594c60e3e1d0b4b304cc Number of compiler warnings: occt component : Linux: 13 (15 on master) Windows: 0 (0 on master) products component : Linux: 39 (39 on master) Windows: 0 (0 on master) There is new additional compilation warning on Linux platform: There are compilation errors in Qt samples products on windows platform: Regressions/Differences/Improvements: No regressions/differences Testing cases: http://occt-tests/CR24537-3-master-occt-64/Debian70-64/bugs/fclasses/bug24537.html http://occt-tests/CR24537-3-master-occt-64/Windows-64-VC10/bugs/fclasses/bug24537.html bugs fclasses bug24537: OK Testing on Linux: occt component : Total MEMORY difference: 92282120 / 92105726 [+0.19%] Total CPU difference: 18763.229999999014 / 18665.439999998966 [+0.52%] products component : Total MEMORY difference: 25921386 / 25980951 [-0.23%] Total CPU difference: 7418.7299999999905 / 7208.589999999996 [+2.92%] Testing on Windows: occt component : Total MEMORY difference: 56806777 / 56823447 [-0.03%] Total CPU difference: 18049.986504299017 / 16808.499346099128 [+7.39%] products component : Total MEMORY difference: 16785580 / 16790438 [-0.03%] Total CPU difference: 5934.1844394 / 5526.49142599996 [+7.38%] There are no differences in images found by testdiff. |
|
Branch CR24537 has been deleted by kgv. SHA-1: 729a7c27424752e546968b44eab13a77dba3b06d |
|
Branch CR24537_3 has been deleted by kgv. SHA-1: ff03877408cf1a23f6c3594c60e3e1d0b4b304cc |
|
Branch CR24537_test has been deleted by kgv. SHA-1: e1eb782e1d1b514737e15e7f705ff554c5f69c7d |
occt: master 10a4116e 2015-09-24 11:17:41
Committer: kgv Details Diff |
0024537: GCC compiler warnings in byte order reversion code Eliminate warnings in byte order inversion functionality by using unions. Add test case simulating conversion to big endian. |
Affected Issues 0024537 |
|
mod - src/BinObjMgt/BinObjMgt_Persistent.cxx | Diff File | ||
mod - src/FSD/FSD_BinaryFile.cxx | Diff File | ||
mod - src/FSD/FSD_BinaryFile.hxx | Diff File | ||
mod - src/FSD/FSD_FileHeader.hxx | Diff File | ||
mod - src/QABugs/QABugs_19.cxx | Diff File | ||
add - tests/bugs/fclasses/bug24537 | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-01-16 13:04 |
|
New Issue | |
2014-01-16 13:04 |
|
Assigned To | => abv |
2014-01-16 13:04 |
|
Relationship added | child of 0024252 |
2014-01-16 13:48 |
|
Summary | GCC compiler warnings in bit order reversion code => GCC compiler warnings in byte order reversion code |
2014-04-04 18:16 |
|
Target Version | 6.7.1 => 6.8.0 |
2014-09-03 10:11 |
|
Assigned To | abv => dln |
2014-09-09 14:55 | git | Note Added: 0031515 | |
2014-09-25 15:46 | git | Note Added: 0032159 | |
2014-10-29 06:58 |
|
Target Version | 6.8.0 => 7.1.0 |
2015-01-14 11:34 | git | Note Added: 0036035 | |
2015-01-14 11:35 |
|
Note Added: 0036036 | |
2015-01-14 11:36 |
|
Assigned To | dln => abv |
2015-01-14 11:36 |
|
Status | new => resolved |
2015-01-14 11:36 |
|
Steps to Reproduce Updated | |
2015-05-07 16:50 |
|
Assigned To | abv => msv |
2015-05-07 16:50 |
|
Status | resolved => assigned |
2015-05-07 17:13 | git | Note Added: 0040758 | |
2015-05-07 17:16 |
|
Note Added: 0040759 | |
2015-05-07 17:16 |
|
Assigned To | msv => abv |
2015-05-07 17:16 |
|
Status | assigned => resolved |
2015-05-07 17:17 |
|
Steps to Reproduce Updated | |
2015-05-07 17:52 |
|
Note Added: 0040763 | |
2015-05-07 17:52 |
|
Status | resolved => assigned |
2015-05-07 17:52 |
|
Assigned To | abv => msv |
2015-05-08 17:41 | git | Note Added: 0040809 | |
2015-05-08 17:43 |
|
Note Added: 0040810 | |
2015-05-08 17:43 |
|
Assigned To | msv => abv |
2015-05-08 17:43 |
|
Status | assigned => resolved |
2015-05-12 13:03 |
|
Note Added: 0040821 | |
2015-05-12 13:03 |
|
Assigned To | abv => msv |
2015-05-12 13:03 |
|
Status | resolved => assigned |
2015-09-16 11:43 | git | Note Added: 0045699 | |
2015-09-16 11:47 |
|
Note Added: 0045700 | |
2015-09-18 15:54 |
|
Assigned To | msv => rkv |
2015-09-22 12:53 | git | Note Added: 0045993 | |
2015-09-22 13:23 |
|
Assigned To | rkv => msv |
2015-09-22 13:23 |
|
Status | assigned => resolved |
2015-09-23 11:12 |
|
Note Added: 0046024 | |
2015-09-23 11:12 |
|
Assigned To | msv => bugmaster |
2015-09-23 11:12 |
|
Status | resolved => reviewed |
2015-09-23 11:13 |
|
Target Version | 7.1.0 => 7.0.0 |
2015-09-23 17:54 |
|
Assigned To | bugmaster => mkv |
2015-09-24 12:10 |
|
Note Added: 0046080 | |
2015-09-24 12:10 |
|
Assigned To | mkv => bugmaster |
2015-09-24 12:10 |
|
Status | reviewed => tested |
2015-09-24 12:10 |
|
Test case number | => bugs fclasses bug24537 |
2015-09-24 12:10 |
|
Note Edited: 0046080 | |
2015-09-28 12:58 | kgv | Changeset attached | => occt master 10a4116e |
2015-09-28 12:58 | kgv | Assigned To | bugmaster => kgv |
2015-09-28 12:58 | kgv | Status | tested => verified |
2015-09-28 12:58 | kgv | Resolution | open => fixed |
2015-10-16 16:28 | git | Note Added: 0046942 | |
2015-10-16 16:28 | git | Note Added: 0046943 | |
2015-10-16 16:57 | git | Note Added: 0047059 | |
2016-04-20 15:44 |
|
Fixed in Version | => 7.0.0 |
2016-04-20 15:48 |
|
Status | verified => closed |
2020-11-25 17:37 | kgv | Relationship added | related to 0020979 |