D15764: [Custom-DefinesAndIncludes]: Objective-C++ support
René J.V. Bertin
noreply at phabricator.kde.org
Thu Sep 27 15:26:33 BST 2018
rjvbb added a comment.
`__builtin_unreachable()` does have strange effects:
#include <stdio.h>
int foo(int doit)
{
switch(doit) {
case 0:
case 1:
case 2:
return doit;
default:
__builtin_unreachable();
}
}
int main(int argc, char *argv[])
{
fprintf(stderr, "foo(0)=%d\n", foo(0));
foo(1);
foo(2);
fprintf(stderr, "unreachable foo(4)=");
fprintf(stderr, "%d\n", foo(4));
return 0;
}
Depending on how and with what compiler I build this, the program either loops (from the `foo(4)` call back to the start of `main`) until it SEGVs, or it terminates after printing `foo(4)=4`
IOW, it looks like it just causes UB in release builds when the assert is removed from Q_UNREACHABLE :-/
REPOSITORY
R32 KDevelop
REVISION DETAIL
https://phabricator.kde.org/D15764
To: rjvbb, #kdevelop, aaronpuchert
Cc: aaronpuchert, kdevelop-devel, glebaccon, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20180927/5f4bb810/attachment.html>
More information about the KDevelop-devel
mailing list