View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000769 | OpenMPT | libopenmpt | public | 2016-04-26 09:58 | 2016-04-26 17:08 |
Reporter | sraue | Assigned To | manx | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Linux | ||||
Product Version | OpenMPT 1.25.04.00 / libopenmpt 0.2-beta16 (upgrade first) | ||||
Fixed in Version | OpenMPT 1.26.01.00 / libopenmpt 0.2-beta17 (upgrade first) | ||||
Summary | 0000769: libopenmpt fails to build with gcc-6 | ||||
Description | libopenmpt-0.2.5787-beta16 fails to build with gcc-6 (RC) | ||||
Steps To Reproduce | compile libopenmpt with gcc-6 | ||||
Additional Information | Generic.x86_64-8.0-devel/libopenmpt-0.2.5787-beta16/libopenmpt/libopenmpt_ext.cpp -o libopenmpt/libopenmpt_la-libopenmpt_ext.o
| ||||
Tags | No tags attached. | ||||
Attached Files | bug-769-fix-v1.patch (610 bytes)
Index: soundlib/tuning.cpp =================================================================== --- soundlib/tuning.cpp (revision 6294) +++ soundlib/tuning.cpp (working copy) @@ -375,7 +375,8 @@ if(!IsOfType(TT_GROUPGEOMETRIC)) return 0; if(note >= 0) return note % GetGroupSize(); - else return (GetGroupSize() - (abs(note) % GetGroupSize())) % GetGroupSize(); + // static_cast<int>(note) because g++-6 template-disables std::abs overloads for 8bit and 16bit integer types via std::enable_if. + else return (GetGroupSize() - (std::abs(static_cast<int>(note)) % GetGroupSize())) % GetGroupSize(); } | ||||
Has the bug occurred in previous versions? | |||||
Tested code revision (in case you know it) | |||||
Seems like it must be a bug in this RC, you can easily see that both operands are int16 and uint16, certainly not double? |
|
From a first glance, this looks like a GCC6 bug to me. I have to do further investigation here though. |
|
https://bugs.openmpt.org/file_download.php?file_id=177&type=bug will also apply to 0.2.5787-beta16, if you prefer to stay on -beta16. |
|
So, I'm still not sure whether this is a GCC 6 problem or in fact a language specification problem. Quoting the relevant sections: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4582.pdf P.1080 § 26.9.10 "If abs() is called with an argument of type X for which is_unsigned<X>::value is true and if X cannot be converted to int by integral promotion (4.5), the program is ill-formed. [ Note: Arguments that can be promoted to int are permitted for compatibility with C. — end note ]" http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/n4582.pdf P.1083 § 26.9.15.2 "Otherwise, if any argument of arithmetic type corresponding to a double parameter has type double or an integer type, then all arguments of arithmetic type corresponding to double parameters are effectively cast to double." In any case, the work-around is correct and will work for all old and new compilers. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2016-04-26 09:58 | sraue | New Issue | |
2016-04-26 10:20 | Saga Musix | Note Added: 0002346 | |
2016-04-26 10:43 | manx | Assigned To | => manx |
2016-04-26 10:43 | manx | Status | new => assigned |
2016-04-26 13:53 | manx | Status | assigned => confirmed |
2016-04-26 14:17 | manx | Note Added: 0002349 | |
2016-04-26 14:17 | manx | File Added: bug-769-fix-v1.patch | |
2016-04-26 14:23 | manx | Note Added: 0002350 | |
2016-04-26 16:57 | manx | Note Added: 0002353 | |
2016-04-26 16:57 | manx | Status | confirmed => resolved |
2016-04-26 16:57 | manx | Fixed in Version | => OpenMPT 1.26.01.00 / libopenmpt 0.2-beta17 (upgrade first) |
2016-04-26 16:57 | manx | Resolution | open => fixed |
2016-04-26 17:08 | manx | Note Edited: 0002353 |