search for: do_something_2

Displaying 15 results from an estimated 15 matches for "do_something_2".

Did you mean: do_something_1
2017 Jun 30
3
The undef story
...ith undefined behavior. So I am puzzled, That’s why I’m still asking for a more concrete example showing how We can optimize based on undefined behavior. Peter Lawrence. For reference here’s your second version with the plain “else” rather than “else if" void do_something_1(int); void do_something_2(); template <typename T> int do_something(T mask, bool cond) { if (mask & 2) return 42; if (cond) { T high_mask = mask >> 48; if (high_mask > 5) do_something_1(high_mask); else do_something_2(); } return 0; } char foo(); bool alwaysfalse()...
2017 Jun 29
6
The undef story
...2) >>>> return 1; >>>> >>>> if (cond) { >>>> T high_mask = mask >> 48; >>>> if (high_mask > 5) >>>> do_something_1(high_mask); >>>> else if (high_mask > 3) >>>> do_something_2(); >>>> } >>>> >>>> return 0; >>>> } >>>> >>>> This function ended up being instantiated on different types T (e.g. unsigned char, unsigned int, unsigned long, etc.) and, dynamically, cond was always false when T was char...
2017 Jun 29
1
The undef story
...int do_something(T mask, bool cond) { >> if (mask & 2) >> return 1; >> >> if (cond) { >> T high_mask = mask >> 48; >> if (high_mask > 5) >> do_something_1(high_mask); >> else if (high_mask > 3) >> do_something_2(); >> } >> >> return 0; >> } >> >> This function ended up being instantiated on different types T (e.g. >> unsigned char, unsigned int, unsigned long, etc.) and, dynamically, >> cond was always false when T was char. The question is: Can the &g...
2017 Jun 29
5
The undef story
...{ >>> if (mask & 2) >>> return 1; >>> >>> if (cond) { >>> T high_mask = mask >> 48; >>> if (high_mask > 5) >>> do_something_1(high_mask); >>> else if (high_mask > 3) >>> do_something_2(); >>> } >>> >>> return 0; >>> } >>> >>> This function ended up being instantiated on different types T (e.g. unsigned char, unsigned int, unsigned long, etc.) and, dynamically, cond was always false when T was char. The question is: Can t...
2017 Jul 01
0
The undef story
...{ >>> if (mask & 2) >>> return 1; >>> >>> if (cond) { >>> T high_mask = mask >> 48; >>> if (high_mask > 5) >>> do_something_1(high_mask); >>> else if (high_mask > 3) >>> do_something_2(); >>> } >>> >>> return 0; >>> } >>> Hal, yes, there are times when it is expedient to suppress or ignore warnings, but I don’t believe this is one of them, a suggestion could have been made to change the source code along the lines of...
2017 Jun 29
8
The undef story
...t; template <typename T> > int do_something(T mask, bool cond) { > if (mask & 2) > return 1; > > if (cond) { > T high_mask = mask >> 48; > if (high_mask > 5) > do_something_1(high_mask); > else if (high_mask > 3) > do_something_2(); > } > > return 0; > } > > This function ended up being instantiated on different types T (e.g. unsigned char, unsigned int, unsigned long, etc.) and, dynamically, cond was always false when T was char. The question is: Can the compiler eliminate all of the code predicated...
2017 Jul 24
2
GEP with a null pointer base
...int do_something(T mask, bool cond) { > if (mask & 2) > return 42; > > if (cond) { > T high_mask = mask >> 48; // UB if sizeof(T) < 8, and cond true > if (high_mask > 5) > do_something_1(high_mask); > else > do_something_2(); > } > > return 0; > } Which is then instantiated with T = char, and where it is impossible for either a static analyzer or a compiler to figure out and prove that ‘cond’ is always false. Hence a static analyzer issues a warning about the shift, while llvm gives no warning an...
2017 Jul 27
2
GEP with a null pointer base
...{ >> if (mask & 2) >> return 42; >> >> if (cond) { >> T high_mask = mask >> 48; // UB if sizeof(T) < 8, and cond true >> if (high_mask > 5) >> do_something_1(high_mask); >> else >> do_something_2(); >> } >> >> return 0; >> } > > > Which is then instantiated with T = char, > and where it is impossible for either a static analyzer or a > compiler to figure out and prove that ‘cond’ is always false. > > Hence a static analyzer issues a warn...
2017 Jul 28
2
GEP with a null pointer base
...>>> return 42; >>> >>> if (cond) { >>> T high_mask = mask >> 48; // UB if sizeof(T) < 8, and cond true >>> if (high_mask > 5) >>> do_something_1(high_mask); >>> else >>> do_something_2(); >>> } >>> >>> return 0; >>> } >> >> >> Which is then instantiated with T = char, >> and where it is impossible for either a static analyzer or a >> compiler to figure out and prove that ‘cond’ is always false. >> &g...
2017 Jul 31
2
GEP with a null pointer base
...>>>> >>>> if (cond) { >>>> T high_mask = mask >> 48; // UB if sizeof(T) < 8, and cond true >>>> if (high_mask > 5) >>>> do_something_1(high_mask); >>>> else >>>> do_something_2(); >>>> } >>>> >>>> return 0; >>>> } >>> >>> >>> Which is then instantiated with T = char, >>> and where it is impossible for either a static analyzer or a >>> compiler to figure out and prove that...
2017 Jul 22
2
GEP with a null pointer base
Mehdi, Hal’s transformation only kicks in in the *presence* of UB, and it does not matter how that UB got there, whether by function inlining or without function inlining. The problem with Hal’s argument is that the compiler does not have a built in ouija board with which it can conjure up the spirit of the author of the source code and find out if the UB was intentional with the
2017 Jul 31
4
GEP with a null pointer base
...>>>> if (cond) { >>>> T high_mask = mask >> 48; // UB if sizeof(T) < 8, >>>> and cond true >>>> if (high_mask > 5) >>>> do_something_1(high_mask); >>>> else >>>> do_something_2(); >>>> } >>>> >>>> return 0; >>>> } >>>> >>>> >>>> Which is then instantiated with T = char, >>>> and where it is impossible for either a static analyzer or a >>>> compiler to figure out...
2017 Aug 01
0
GEP with a null pointer base
...t;>>> if (cond) { >>>>> T high_mask = mask >> 48; // UB if sizeof(T) < 8, and cond true >>>>> if (high_mask > 5) >>>>> do_something_1(high_mask); >>>>> else >>>>> do_something_2(); >>>>> } >>>>> >>>>> return 0; >>>>> } >>>> >>>> >>>> Which is then instantiated with T = char, >>>> and where it is impossible for either a static analyzer or a >>>> co...
2017 Jun 28
9
The undef story
Chandler, where we disagree is in whether the current project is moving the issue forward. It is not. It is making the compiler more complex for no additional value. The current project is not based in evidence, I have asked for any SPEC benchmark that shows performance gain by the compiler taking advantage of “undefined behavior” and no one can show that. The current project
2006 Apr 05
23
how to create RJS visual effects callbacks
I''m trying desperately to get visuall effects callbacks working in rjs templates to no avail What I''m trying to do is fade an image, change the div with the image to a new image, and then fade the new image back in. How would I go about this in RJS Here''s a simple line from my rjs that I can''t get to work. It is not using callbacks so the