public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/67879] New: unnecessary jump in ternary
@ 2015-10-07 6:32 marccelani at fb dot com
0 siblings, 0 replies; only message in thread
From: marccelani at fb dot com @ 2015-10-07 6:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67879
Bug ID: 67879
Summary: unnecessary jump in ternary
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: marccelani at fb dot com
Target Milestone: ---
The following functions f and f2 should compile the same, but f includes a jump
whereas f2 properly avoids the jump and adds the result of the comparison.
int f(int a, int b, int* c) {
bool x = a < b;
return x ? *c : *c + 1;
}
int f2(int a, int b, int* c) {
bool x = a < b;
return *c + (x ? 0 : 1);
}
https://goo.gl/OFhXTp
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-10-07 6:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-07 6:32 [Bug c/67879] New: unnecessary jump in ternary marccelani at fb dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).